Thread (2 messages) flat view 2 messages, 2 authors, 2016-07-08

Re: [PATCH v2 2/2] cache-tree: do not generate empty trees as a result of all i-t-a subentries

From: Duy Nguyen <hidden>
Date: 2016-07-08 16:38:11

On Fri, Jul 8, 2016 at 5:53 PM, Junio C Hamano [off-list ref] wrote:
Duy Nguyen [off-list ref] writes:
quoted
Yeah that's better. So the squash patch is something like this
Rather...
quoted
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
        written=$(git write-tree) &&
        git ls-tree "$written" >actual &&
        ! grep 1 actual

That way, we have one less thing to worry about when the hash
function changes in the future.  You may want to rename 1/2/3
to something more readable (e.g. dir/2/3) and grep for "dir"
instead, though.
I thought about that too, then did a grep which showed empty sha1 tree
was used elsewhere. And thought of sending a patch to define
$EMPTY_SHA1 in test-lib-functions.sh or somewhere so we don't hard
code it everywhere, but I didn't. But yeah ls-tree works. The last
line could be test_must_be_empty actual (a bit stricter than grep 1)
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help