summaryrefslogtreecommitdiff
path: root/name-hash.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-27 10:33:53 -0800
committerJunio C Hamano <gitster@pobox.com>2018-02-27 10:33:53 -0800
commit2ac76d8d9dccaaecf3c01845d0f7c1808c75722b (patch)
treec41cfd61f019926cbf7699a4e6813b8c10f534da /name-hash.c
parentee9db32d42a4b628157ecd395305d83cc630f7aa (diff)
parentc95525e90d2f3c75b879ce51fd17d263a6452de3 (diff)
downloadgit-2ac76d8d9dccaaecf3c01845d0f7c1808c75722b.tar.gz
Merge branch 'bp/name-hash-dirname-fix'
"git add" files in the same directory, but spelling the directory path in different cases on case insensitive filesystem, corrupted the name hash data structure and led to unexpected results. This has been corrected. * bp/name-hash-dirname-fix: name-hash: properly fold directory names in adjust_dirname_case()
Diffstat (limited to 'name-hash.c')
-rw-r--r--name-hash.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/name-hash.c b/name-hash.c
index ada66f066a..163849831c 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -699,12 +699,12 @@ void adjust_dirname_case(struct index_state *istate, char *name)
if (*ptr == '/') {
struct dir_entry *dir;
- ptr++;
- dir = find_dir_entry(istate, name, ptr - name + 1);
+ dir = find_dir_entry(istate, name, ptr - name);
if (dir) {
memcpy((void *)startPtr, dir->name + (startPtr - name), ptr - startPtr);
- startPtr = ptr;
+ startPtr = ptr + 1;
}
+ ptr++;
}
}
}