summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Doug Kelly <dougk.ff7@gmail.com>2015-11-03 21:05:07 -0600
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-11-04 11:30:10 -0800
commite6d65c9a47a0f245614d34246fe28782a6d2209b (patch)
treeb16434bdc0e0637570984a31cea0222f004f080f /t
parentprepare_packed_git(): refactor garbage reporting in pack directory (diff)
downloadtgif-e6d65c9a47a0f245614d34246fe28782a6d2209b.tar.xz
t5304: test cleaning pack garbage
Pack garbage, noticeably stale .idx files, can be cleaned up during a garbage collection. This tests to ensure such garbage is properly cleaned up. Note that the prior test for checking pack garbage with count-objects left some stale garbage after the test exited. This has also been corrected. Signed-off-by: Doug Kelly <dougk.ff7@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5304-prune.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 023d7c6f7b..029751544f 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -219,6 +219,7 @@ test_expect_success 'gc: prune old objects after local clone' '
test_expect_success 'garbage report in count-objects -v' '
test_when_finished "rm -f .git/objects/pack/fake*" &&
+ test_when_finished "rm -f .git/objects/pack/foo*" &&
: >.git/objects/pack/foo &&
: >.git/objects/pack/foo.bar &&
: >.git/objects/pack/foo.keep &&
@@ -244,6 +245,26 @@ EOF
test_cmp expected actual
'
+test_expect_failure 'clean pack garbage with gc' '
+ test_when_finished "rm -f .git/objects/pack/fake*" &&
+ test_when_finished "rm -f .git/objects/pack/foo*" &&
+ : >.git/objects/pack/foo.keep &&
+ : >.git/objects/pack/foo.pack &&
+ : >.git/objects/pack/fake.idx &&
+ : >.git/objects/pack/fake2.keep &&
+ : >.git/objects/pack/fake2.idx &&
+ : >.git/objects/pack/fake3.keep &&
+ git gc &&
+ git count-objects -v 2>stderr &&
+ grep "^warning:" stderr | sort >actual &&
+ cat >expected <<\EOF &&
+warning: no corresponding .idx or .pack: .git/objects/pack/fake3.keep
+warning: no corresponding .idx: .git/objects/pack/foo.keep
+warning: no corresponding .idx: .git/objects/pack/foo.pack
+EOF
+ test_cmp expected actual
+'
+
test_expect_success 'prune .git/shallow' '
SHA1=`echo hi|git commit-tree HEAD^{tree}` &&
echo $SHA1 >.git/shallow &&