On Thu, Jul 07, 2016 at 11:52:58AM -0700, Junio C Hamano wrote:
> Duy Nguyen <[email protected]> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html