From: Eric Sunshine Date: Fri, 11 Jul 2014 23:56:35 GMT Subject: Re: [PATCH v7 4/4] cache-tree: Write updated cache-tree after commit Message-ID: In-Reply-To: <1405120947-3142-4-git-send-email-dturner@twitter.com> On Fri, Jul 11, 2014 at 7:22 PM, David Turner wrote: > During the commit process, update the cache-tree. Write this updated > cache-tree so that it's ready for subsequent commands. > > Add test code which demonstrates that git commit now writes the cache > tree. Make all tests test the entire cache-tree, not just the root > level. > > Signed-off-by: David Turner > diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh > index 3a3342e..57f263f 100755 > --- a/t/t0090-cache-tree.sh > +++ b/t/t0090-cache-tree.sh > @@ -90,37 +128,86 @@ test_expect_success 'test-scrap-cache-tree works' ' > > test_expect_success 'second commit has cache-tree' ' > test_commit bar && > - test_shallow_cache_tree > + test_cache_tree > +' > + > +test_expect_success 'commit -i gives cache-tree' ' > + git checkout current && > + cat <<-\EOT >foo.c && > + int foo() > + { > + return 42; > + } > + int bar() > + { > + return 42; > + } > + EOT > + git add foo.c > + test_invalid_cache_tree > + git commit -m "add a file" > + test_cache_tree Broken &&-chain on all four lines above. > + cat <<-\EOT >foo.c && > + int foo() > + { > + return 43; > + } > + int bar() > + { > + return 44; > + } > + EOT > + (echo p; echo 1; echo; echo s; echo n; echo y; echo q) | git commit --interactive -m foo Broken &&-chain. Would a printf make this more readable? printf "p\n1\n\ns\nn\ny\nq\n" | git commt ... && Perhaps not. > + test_cache_tree > +' > + > +test_expect_success 'commit in child dir has cache-tree' ' > + mkdir dir && > + >dir/child.t && > + git add dir/child.t && > + git commit -m dir/child.t && > + test_cache_tree > ' > > test_expect_success 'reset --hard gives cache-tree' ' > test-scrap-cache-tree && > git reset --hard && > - test_shallow_cache_tree > + test_cache_tree > ' > > test_expect_success 'reset --hard without index gives cache-tree' ' > rm -f .git/index && > git reset --hard && > - test_shallow_cache_tree > + test_cache_tree > ' > > test_expect_success 'checkout gives cache-tree' ' > git tag current && > git checkout HEAD^ && > - test_shallow_cache_tree > + test_cache_tree > ' > > test_expect_success 'checkout -b gives cache-tree' ' > git checkout current && > git checkout -b prev HEAD^ && > - test_shallow_cache_tree > + test_cache_tree > ' > > test_expect_success 'checkout -B gives cache-tree' ' > git checkout current && > git checkout -B prev HEAD^ && > - test_shallow_cache_tree > + test_cache_tree > +' > + > +test_expect_success 'partial commit gives cache-tree' ' > + git checkout -b partial no-children && > + test_commit one && > + test_commit two && > + echo "some change" >one.t && > + git add one.t && > + echo "some other change" >two.t && > + git commit two.t -m partial && > + test_cache_tree > ' > > test_done > -- > 2.0.0.390.gcb682f8