Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Sun, 24 Aug 2008 01:28:37 +0000 (18:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Aug 2008 01:28:37 +0000 (18:28 -0700)
* maint:
unpack_trees(): protect the handcrafted in-core index from read_cache()
git-p4: Fix one-liner in p4_write_pipe function.
Completion: add missing '=' for 'diff --diff-filter'
Fix 'git help help'

1  2 
cache.h
read-cache.c
diff --combined cache.h
index a097a959bd4279e61eebd4f20589d337c8ec977b,884fae826cb8c296520aecbc8c23d9848dacb606..ab9f97efc6be1e40a59e03463aa921d339420f6c
+++ b/cache.h
@@@ -126,7 -126,6 +126,7 @@@ struct cache_entry 
  
  #define CE_NAMEMASK  (0x0fff)
  #define CE_STAGEMASK (0x3000)
 +#define CE_EXTENDED  (0x4000)
  #define CE_VALID     (0x8000)
  #define CE_STAGESHIFT 12
  
@@@ -223,7 -222,8 +223,8 @@@ struct index_state 
        struct cache_tree *cache_tree;
        time_t timestamp;
        void *alloc;
-       unsigned name_hash_initialized : 1;
+       unsigned name_hash_initialized : 1,
+                initialized : 1;
        struct hash_table name_hash;
  };
  
@@@ -392,6 -392,7 +393,6 @@@ extern int ie_modified(const struct ind
  
  extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
  extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path);
 -extern int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object);
  extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
  extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
  
@@@ -451,7 -452,6 +452,7 @@@ enum safe_crlf 
  extern enum safe_crlf safe_crlf;
  
  enum branch_track {
 +      BRANCH_TRACK_UNSPECIFIED = -1,
        BRANCH_TRACK_NEVER = 0,
        BRANCH_TRACK_REMOTE,
        BRANCH_TRACK_ALWAYS,
diff --combined read-cache.c
index f0ba2247980cc938cc3f821a18e3b328966c4e06,35fec468b1951cc17606fca8edc47f809471f652..a857c8e12fe4c83e98ccbd772b21fd3e66913ea5
@@@ -1118,10 -1118,6 +1118,10 @@@ static void convert_from_disk(struct on
        ce->ce_size  = ntohl(ondisk->size);
        /* On-disk flags are just 16 bits */
        ce->ce_flags = ntohs(ondisk->flags);
 +
 +      /* For future extension: we do not understand this entry yet */
 +      if (ce->ce_flags & CE_EXTENDED)
 +              die("Unknown index entry format");
        hashcpy(ce->sha1, ondisk->sha1);
  
        len = ce->ce_flags & CE_NAMEMASK;
@@@ -1159,7 -1155,7 +1159,7 @@@ int read_index_from(struct index_state 
        size_t mmap_size;
  
        errno = EBUSY;
-       if (istate->alloc)
+       if (istate->initialized)
                return istate->cache_nr;
  
        errno = ENOENT;
         * index size
         */
        istate->alloc = xmalloc(estimate_cache_size(mmap_size, istate->cache_nr));
+       istate->initialized = 1;
  
        src_offset = sizeof(*hdr);
        dst_offset = 0;
@@@ -1251,6 -1248,7 +1252,7 @@@ int discard_index(struct index_state *i
        cache_tree_free(&(istate->cache_tree));
        free(istate->alloc);
        istate->alloc = NULL;
+       istate->initialized = 0;
  
        /* no need to throw away allocated active_cache */
        return 0;