From: Junio C Hamano <gitster@pobox•com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
Cc: git@vger•kernel.org, yuri.kanivetsky@gmail•com
Subject: Re: [PATCH] cache-tree.c: fix i-t-a check skipping directory updates sometimes
Date: Wed, 06 Jul 2016 10:55:02 -0700 [thread overview]
Message-ID: <xmqq8txetzwp.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqqd1mqu0g6.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Wed, 06 Jul 2016 10:43:21 -0700")
Junio C Hamano <gitster@pobox•com> writes:
> Nguyễn Thái Ngọc Duy <pclouds@gmail•com> 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
)
'
next prev parent reply other threads:[~2016-07-06 17:55 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 13:50 Git doesn't always add files to a commit (amend) Yuri Kanivetsky
2016-07-04 15:48 ` Duy Nguyen
2016-07-04 17:48 ` [PATCH] cache-tree.c: fix i-t-a check skipping directory updates sometimes Nguyễn Thái Ngọc Duy
2016-07-06 17:43 ` Junio C Hamano
2016-07-06 17:55 ` Junio C Hamano [this message]
2016-07-06 18:48 ` [PATCH v2 0/2] cache-tree building fix in the presence of ita entries Nguyễn Thái Ngọc Duy
2016-07-06 18:48 ` [PATCH v2 1/2] cache-tree.c: fix i-t-a entry skipping directory updates sometimes Nguyễn Thái Ngọc Duy
2016-07-06 18:48 ` [PATCH v2 2/2] cache-tree: do not generate empty trees as a result of all i-t-a subentries Nguyễn Thái Ngọc Duy
2016-07-06 19:26 ` Junio C Hamano
2016-07-07 17:12 ` Duy Nguyen
2016-07-07 18:52 ` Junio C Hamano
2016-07-08 15:39 ` Duy Nguyen
2016-07-08 15:53 ` Junio C Hamano
2016-07-08 16:36 ` Duy Nguyen
2016-07-08 17:23 ` Junio C Hamano
2016-07-09 5:23 ` [PATCH v3 0/4] cache-tree building fix in the presence of ita entries Nguyễn Thái Ngọc Duy
2016-07-09 5:23 ` [PATCH v3 1/4] test-lib.sh: introduce and use $_EMPTY_TREE Nguyễn Thái Ngọc Duy
2016-07-12 20:40 ` Junio C Hamano
2016-07-13 15:04 ` Duy Nguyen
2016-07-09 5:23 ` [PATCH v3 2/4] test-lib.sh: introduce and use $_EMPTY_BLOB Nguyễn Thái Ngọc Duy
2016-07-09 5:23 ` [PATCH v3 3/4] cache-tree.c: fix i-t-a entry skipping directory updates sometimes Nguyễn Thái Ngọc Duy
2016-07-09 5:23 ` [PATCH v3 4/4] cache-tree: do not generate empty trees as a result of all i-t-a subentries Nguyễn Thái Ngọc Duy
2016-07-12 20:49 ` Junio C Hamano
2016-07-13 14:59 ` Duy Nguyen
2016-07-16 5:06 ` [PATCH v4 0/4] cache-tree building fix in the presence of ita entries Nguyễn Thái Ngọc Duy
2016-07-16 5:06 ` [PATCH v4 1/4] test-lib.sh: introduce and use $EMPTY_TREE Nguyễn Thái Ngọc Duy
2016-07-16 5:06 ` [PATCH v4 2/4] test-lib.sh: introduce and use $EMPTY_BLOB Nguyễn Thái Ngọc Duy
2016-07-16 5:06 ` [PATCH v4 3/4] cache-tree.c: fix i-t-a entry skipping directory updates sometimes Nguyễn Thái Ngọc Duy
2016-07-16 5:06 ` [PATCH v4 4/4] cache-tree: do not generate empty trees as a result of all i-t-a subentries Nguyễn Thái Ngọc Duy
2016-07-18 20:48 ` [PATCH v4 0/4] cache-tree building fix in the presence of ita entries Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq8txetzwp.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=pclouds@gmail$(echo .)com \
--cc=yuri.kanivetsky@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox