Junio C Hamano <gitster@xxxxxxxxx> writes: > Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> writes: > >> Fix it by making sure we only skip i-t-a entries when the entry in >> question is actual an index entry, not a directory. > > Aha. Good catch. > > However, this makes me wonder if subdir has only files all of which > are i-t-a. The resulting top-level tree object should not record > subdir/ as an empty (sub)directory in that case. I do not see where > you are ensuring it in the patch below, though. Here is a fix-up to the test part to avoid "touch" if we are not interested in timestamp, and to avoid "git" command in the upstream of a pipe, plus an additional test to help further bugfix to make sure a directory that becomes empty with this culling is not included in the end result. Thanks for looking into this topic. t/t2203-add-intent.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh index 12d701c..1fc8d3f 100755 --- a/t/t2203-add-intent.sh +++ b/t/t2203-add-intent.sh @@ -87,11 +87,33 @@ test_expect_success 'cache-tree does not ignore dir that has i-t-a entries' ' ( cd ita-in-dir && mkdir 2 && - touch 1 2/1 2/2 3 && + for f in 1 2/1 2/2 3 + do + echo "$f" >"$f" + done && git add 1 2/2 3 && git add -N 2/1 && - git commit -m comitted && - git ls-tree -r HEAD | grep 2/2 + git commit -m committed && + git ls-tree -r HEAD >actual && + grep 2/2 actual + ) +' + +test_expect_success 'cache-tree does skip dir that becomes empty' ' + rm -fr ita-in-dir && + git init ita-in-dir && + ( + cd ita-in-dir && + mkdir 2 && + for f in 1 2/1 2/2 3 + do + echo "$f" >"$f" + done && + git add 1 3 && + git add -N 2/1 && + git commit -m committed && + git ls-tree HEAD >actual && + ! grep 2 actual ) ' -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html