From: Duy Nguyen <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, yuri.kanivetsky@gmail.com
Subject: Re: [PATCH v2 2/2] cache-tree: do not generate empty trees as a result of all i-t-a subentries
Date: Fri, 8 Jul 2016 17:39:30 +0200 [thread overview]
Message-ID: <20160708153930.GA19448@duynguyen> (raw)
In-Reply-To: <xmqqmvltp9f9.fsf@gitster.mtv.corp.google.com>
On Thu, Jul 07, 2016 at 11:52:58AM -0700, Junio C Hamano wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
>
> > I'll deal with that separately. Let's focus on cache-tree only this
> > time. So how about this on top?
>
> I was hoping that you would limit the scope of the test to check if
> write-tree does the right thing. i.e. not test "git commit", but
> test "git write-tree".
>
Yeah that's better. So the squash patch is something like this
-- 8< --
diff --git a/cache-tree.c b/cache-tree.c
index 75e73d7..2d50640 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -433,15 +433,6 @@ int cache_tree_update(struct index_state *istate, int flags)
i = update_one(it, cache, entries, "", 0, &skip, flags);
if (i < 0)
return i;
- /*
- * Top dir can become empty if all entries are i-t-a (even
- * from subdirs). Note that we do allow to create an empty
- * tree from an empty index. Only error when an empty tree is
- * a result of the i-t-a thing.
- */
- if (it->entry_count < 0 &&
- !hashcmp(it->sha1, EMPTY_TREE_SHA1_BIN))
- return error(_("cannot build a tree from just intent-to-add entries"));
istate->cache_changed |= CACHE_TREE_CHANGED;
return 0;
}
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index a19f06b..80880b7 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -107,7 +107,9 @@ test_expect_success 'cache-tree does skip dir that becomes empty' '
mkdir -p 1/2/3 &&
echo 4 >1/2/3/4 &&
git add -N 1/2/3/4 &&
- test_must_fail git commit -m committed
+ git write-tree >actual &&
+ echo 4b825dc642cb6eb9a060e54bf8d69288fbee4904 >empty-tree &&
+ test_cmp empty-tree actual
)
'
-- 8< --
--
Duy
next prev parent reply other threads:[~2016-07-08 15:39 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
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 [this message]
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=20160708153930.GA19448@duynguyen \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=yuri.kanivetsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).