Skip to content

Commit 6f55f02

Browse files
committed
Merge branch 'jk/name-hash-dirent'
* jk/name-hash-dirent: fix phantom untracked files when core.ignorecase is set
2 parents d2843da + 2548183 commit 6f55f02

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct cache_entry {
168168
unsigned int ce_flags;
169169
unsigned char sha1[20];
170170
struct cache_entry *next;
171+
struct cache_entry *dir_next;
171172
char name[FLEX_ARRAY]; /* more */
172173
};
173174

name-hash.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ static void hash_index_entry_directories(struct index_state *istate, struct cach
5757
if (*ptr == '/') {
5858
++ptr;
5959
hash = hash_name(ce->name, ptr - ce->name);
60-
if (!lookup_hash(hash, &istate->name_hash)) {
61-
pos = insert_hash(hash, ce, &istate->name_hash);
62-
if (pos) {
63-
ce->next = *pos;
64-
*pos = ce;
65-
}
60+
pos = insert_hash(hash, ce, &istate->name_hash);
61+
if (pos) {
62+
ce->dir_next = *pos;
63+
*pos = ce;
6664
}
6765
}
6866
}
@@ -166,7 +164,10 @@ struct cache_entry *index_name_exists(struct index_state *istate, const char *na
166164
if (same_name(ce, name, namelen, icase))
167165
return ce;
168166
}
169-
ce = ce->next;
167+
if (icase && name[namelen - 1] == '/')
168+
ce = ce->dir_next;
169+
else
170+
ce = ce->next;
170171
}
171172

172173
/*

0 commit comments

Comments
 (0)