summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-12-04 11:33:07 -0800
committerJunio C Hamano <gitster@pobox.com>2015-12-04 11:33:08 -0800
commitb50ceab48f46a74571ee2a89048563dd5d3322b9 (patch)
tree21275fc64df75a448de3b2a00802ec2c2dfc32d9 /t
parent908a6e4156dff47d4877478383fd4b79592010e2 (diff)
parent478f34d2b6ea13d5f56ecec04de7ca7ce18367c0 (diff)
downloadgit-b50ceab48f46a74571ee2a89048563dd5d3322b9.tar.gz
Merge branch 'dk/gc-idx-wo-pack' into maint
Having a leftover .idx file without corresponding .pack file in the repository hurts performance; "git gc" learned to prune them. We may want to do the same for .bitmap (and notice but not prune .keep) without corresponding .pack, but that can be a separate topic. * dk/gc-idx-wo-pack: gc: remove garbage .idx files from pack dir t5304: test cleaning pack garbage prepare_packed_git(): refactor garbage reporting in pack directory
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..def203c724 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_success '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 &&