Merge branch 'kb/name-hash' into maint-1.8.1
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Apr 2013 15:44:54 +0000 (08:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Apr 2013 15:44:54 +0000 (08:44 -0700)
* kb/name-hash:
name-hash.c: fix endless loop with core.ignorecase=true

1  2 
cache.h
read-cache.c
diff --combined cache.h
index 2b192d24ac63181b0bba08805c09f004af8ef1dc,2d938eae235b3fb8a65e7b0de53b8fe87f2cb14e..3622e18415ee407d59e6270424d635b5f1df126c
+++ b/cache.h
@@@ -131,7 -131,6 +131,6 @@@ struct cache_entry 
        unsigned int ce_namelen;
        unsigned char sha1[20];
        struct cache_entry *next;
-       struct cache_entry *dir_next;
        char name[FLEX_ARRAY]; /* more */
  };
  
@@@ -267,25 -266,15 +266,15 @@@ struct index_state 
        unsigned name_hash_initialized : 1,
                 initialized : 1;
        struct hash_table name_hash;
+       struct hash_table dir_hash;
  };
  
  extern struct index_state the_index;
  
  /* Name hashing */
  extern void add_name_hash(struct index_state *istate, struct cache_entry *ce);
- /*
-  * We don't actually *remove* it, we can just mark it invalid so that
-  * we won't find it in lookups.
-  *
-  * Not only would we have to search the lists (simple enough), but
-  * we'd also have to rehash other hash buckets in case this makes the
-  * hash bucket empty (common). So it's much better to just mark
-  * it.
-  */
- static inline void remove_name_hash(struct cache_entry *ce)
- {
-       ce->ce_flags |= CE_UNHASHED;
- }
+ extern void remove_name_hash(struct index_state *istate, struct cache_entry *ce);
+ extern void free_name_hash(struct index_state *istate);
  
  
  #ifndef NO_THE_INDEX_COMPATIBILITY_MACROS
@@@ -714,11 -703,10 +703,11 @@@ static inline int is_absolute_path(cons
  }
  int is_directory(const char *);
  const char *real_path(const char *path);
 +const char *real_path_if_valid(const char *path);
  const char *absolute_path(const char *path);
  const char *relative_path(const char *abs, const char *base);
  int normalize_path_copy(char *dst, const char *src);
 -int longest_ancestor_length(const char *path, const char *prefix_list);
 +int longest_ancestor_length(const char *path, struct string_list *prefixes);
  char *strip_path_suffix(const char *path, const char *suffix);
  int daemon_avoid_alias(const char *path);
  int offset_1st_component(const char *path);
@@@ -1150,8 -1138,11 +1139,8 @@@ struct config_include_data 
  #define CONFIG_INCLUDE_INIT { 0 }
  extern int git_config_include(const char *name, const char *value, void *data);
  
 -#define IDENT_NAME_GIVEN 01
 -#define IDENT_MAIL_GIVEN 02
 -#define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN)
 -extern int user_ident_explicitly_given;
 -extern int user_ident_sufficiently_given(void);
 +extern int committer_ident_sufficiently_given(void);
 +extern int author_ident_sufficiently_given(void);
  
  extern const char *git_commit_encoding;
  extern const char *git_log_output_encoding;
@@@ -1181,7 -1172,6 +1170,7 @@@ extern int pager_in_use(void)
  extern int pager_use_color;
  extern int term_columns(void);
  extern int decimal_width(int);
 +extern int check_pager_config(const char *cmd);
  
  extern const char *editor_program;
  extern const char *askpass_program;
@@@ -1264,15 -1254,8 +1253,15 @@@ struct startup_info 
  };
  extern struct startup_info *startup_info;
  
 -/* builtin/merge.c */
 -int checkout_fast_forward(const unsigned char *from, const unsigned char *to);
 +/* merge.c */
 +struct commit_list;
 +int try_merge_command(const char *strategy, size_t xopts_nr,
 +              const char **xopts, struct commit_list *common,
 +              const char *head_arg, struct commit_list *remotes);
 +int checkout_fast_forward(const unsigned char *from,
 +                        const unsigned char *to,
 +                        int overwrite_ignore);
 +
  
  int sane_execvp(const char *file, char *const argv[]);
  
diff --combined read-cache.c
index 5cddbc325ff3f85c693f600836a08fac755846bb,ffb425c0caff2b7b37e3da41639cb5e28a6805fb..b4d08254d656117960d45158bcde695ceac33254
@@@ -46,7 -46,7 +46,7 @@@ static void replace_index_entry(struct 
  {
        struct cache_entry *old = istate->cache[nr];
  
-       remove_name_hash(old);
+       remove_name_hash(istate, old);
        set_index_entry(istate, nr, ce);
        istate->cache_changed = 1;
  }
@@@ -456,7 -456,7 +456,7 @@@ int remove_index_entry_at(struct index_
        struct cache_entry *ce = istate->cache[pos];
  
        record_resolve_undo(istate, ce);
-       remove_name_hash(ce);
+       remove_name_hash(istate, ce);
        istate->cache_changed = 1;
        istate->cache_nr--;
        if (pos >= istate->cache_nr)
@@@ -479,7 -479,7 +479,7 @@@ void remove_marked_cache_entries(struc
  
        for (i = j = 0; i < istate->cache_nr; i++) {
                if (ce_array[i]->ce_flags & CE_REMOVE)
-                       remove_name_hash(ce_array[i]);
+                       remove_name_hash(istate, ce_array[i]);
                else
                        ce_array[j++] = ce_array[i];
        }
@@@ -1256,7 -1256,7 +1256,7 @@@ static int verify_hdr(struct cache_head
        if (hdr->hdr_signature != htonl(CACHE_SIGNATURE))
                return error("bad signature");
        hdr_version = ntohl(hdr->hdr_version);
 -      if (hdr_version < 2 || 4 < hdr_version)
 +      if (hdr_version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < hdr_version)
                return error("bad index version %d", hdr_version);
        git_SHA1_Init(&c);
        git_SHA1_Update(&c, hdr, size - 20);
@@@ -1511,8 -1511,7 +1511,7 @@@ int discard_index(struct index_state *i
        istate->cache_changed = 0;
        istate->timestamp.sec = 0;
        istate->timestamp.nsec = 0;
-       istate->name_hash_initialized = 0;
-       free_hash(&istate->name_hash);
+       free_name_hash(istate);
        cache_tree_free(&(istate->cache_tree));
        istate->initialized = 0;