diff --git a/dir.c b/dir.c index ff768f31af0aa828bdcea83304c81e4ae2cb8444..1000dc236889a340aa1613549fe73fe7f6b2a648 100644 --- a/dir.c +++ b/dir.c @@ -1202,9 +1202,21 @@ static enum path_treatment treat_one_path(struct dir_struct *dir, */ if ((dir->flags & DIR_COLLECT_KILLED_ONLY) && (dtype == DT_DIR) && - !has_path_in_index && - (directory_exists_in_index(path->buf, path->len) == index_nonexistent)) - return path_none; + !has_path_in_index) { + /* + * NEEDSWORK: directory_exists_in_index_icase() + * assumes that one byte past the given path is + * readable and has '/', which needs to be fixed, but + * until then, work it around in the caller. + */ + strbuf_addch(path, '/'); + if (directory_exists_in_index(path->buf, path->len - 1) == + index_nonexistent) { + strbuf_setlen(path, path->len - 1); + return path_none; + } + strbuf_setlen(path, path->len - 1); + } exclude = is_excluded(dir, path->buf, &dtype); diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh index 6ea7ca82658143b344aa09b30ec317196ab67728..ab1deae3b2e759b1cdbc22fd4c5c4bcf31f306c1 100755 --- a/t/t3010-ls-files-killed-modified.sh +++ b/t/t3010-ls-files-killed-modified.sh @@ -78,9 +78,6 @@ date >path7 touch path10 >pathx/ju/nk -test_expect_success \ - 'git ls-files -k to show killed files.' \ - 'git ls-files -k >.output' cat >.expected <.output && + test_cmp .expected .output +' + +test_expect_success 'git ls-files -k to show killed files (w/ icase)' ' + git -c core.ignorecase=true ls-files -k >.output && + test_cmp .expected .output +' test_expect_success \ 'git ls-files -m to show modified files.' \