Skip to content

Commit

Permalink
Merge branch 'jk/name-hash-dirent'
Browse files Browse the repository at this point in the history
* jk/name-hash-dirent:
  fix phantom untracked files when core.ignorecase is set
  • Loading branch information
Junio C Hamano committed Oct 18, 2011
2 parents d2843da + 2548183 commit 6f55f02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ struct cache_entry {
unsigned int ce_flags;
unsigned char sha1[20];
struct cache_entry *next;
struct cache_entry *dir_next;
char name[FLEX_ARRAY]; /* more */
};

Expand Down
15 changes: 8 additions & 7 deletions name-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ static void hash_index_entry_directories(struct index_state *istate, struct cach
if (*ptr == '/') {
++ptr;
hash = hash_name(ce->name, ptr - ce->name);
if (!lookup_hash(hash, &istate->name_hash)) {
pos = insert_hash(hash, ce, &istate->name_hash);
if (pos) {
ce->next = *pos;
*pos = ce;
}
pos = insert_hash(hash, ce, &istate->name_hash);
if (pos) {
ce->dir_next = *pos;
*pos = ce;
}
}
}
Expand Down Expand Up @@ -166,7 +164,10 @@ struct cache_entry *index_name_exists(struct index_state *istate, const char *na
if (same_name(ce, name, namelen, icase))
return ce;
}
ce = ce->next;
if (icase && name[namelen - 1] == '/')
ce = ce->dir_next;
else
ce = ce->next;
}

/*
Expand Down

0 comments on commit 6f55f02

Please sign in to comment.