diff options
author | René Scharfe <l.s.r@web.de> | 2020-07-16 19:11:48 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-07-16 10:42:52 -0700 |
commit | a98f7fb36679a98caa0b804d567b6b2fa8f8ef41 (patch) | |
tree | 6452a1fc1fe7e59286ea9b8e041e5f2a2ba8dc7f /t/lib-t6000.sh | |
parent | Git 2.26.2 (diff) | |
download | tgif-a98f7fb36679a98caa0b804d567b6b2fa8f8ef41.tar.xz |
read-cache: remove bogus shortcut
has_dir_name() has some optimizations for the case where entries are
added to an index in the correct order. They kick in if the new entry
sorts after the last one. One of them exits early if the last entry has
a longer name than the directory of the new entry. Here's its comment:
/*
* The directory prefix lines up with part of
* a longer file or directory name, but sorts
* after it, so this sub-directory cannot
* collide with a file.
*
* last: xxx/yy-file (because '-' sorts before '/')
* this: xxx/yy/abc
*/
However, a file named xxx/yy would be sorted before xxx/yy-file because
'-' sorts after NUL, so the length check against the last entry is not
sufficient to rule out a collision. Remove it.
Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Suggested-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-t6000.sh')
0 files changed, 0 insertions, 0 deletions