Merge branch 'jk/name-hash-dirent'

* jk/name-hash-dirent:
  fix phantom untracked files when core.ignorecase is set
maint
Junio C Hamano 2011-10-17 21:37:11 -07:00
commit 6f55f02815
2 changed files with 9 additions and 7 deletions

View File

@ -168,6 +168,7 @@ struct cache_entry {
unsigned int ce_flags; unsigned int ce_flags;
unsigned char sha1[20]; unsigned char sha1[20];
struct cache_entry *next; struct cache_entry *next;
struct cache_entry *dir_next;
char name[FLEX_ARRAY]; /* more */ char name[FLEX_ARRAY]; /* more */
}; };



View File

@ -57,16 +57,14 @@ static void hash_index_entry_directories(struct index_state *istate, struct cach
if (*ptr == '/') { if (*ptr == '/') {
++ptr; ++ptr;
hash = hash_name(ce->name, ptr - ce->name); hash = hash_name(ce->name, ptr - ce->name);
if (!lookup_hash(hash, &istate->name_hash)) {
pos = insert_hash(hash, ce, &istate->name_hash); pos = insert_hash(hash, ce, &istate->name_hash);
if (pos) { if (pos) {
ce->next = *pos; ce->dir_next = *pos;
*pos = ce; *pos = ce;
} }
} }
} }
} }
}


static void hash_index_entry(struct index_state *istate, struct cache_entry *ce) static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
{ {
@ -166,6 +164,9 @@ struct cache_entry *index_name_exists(struct index_state *istate, const char *na
if (same_name(ce, name, namelen, icase)) if (same_name(ce, name, namelen, icase))
return ce; return ce;
} }
if (icase && name[namelen - 1] == '/')
ce = ce->dir_next;
else
ce = ce->next; ce = ce->next;
} }