Skip to content

Commit dab3247

Browse files
ttaylorrgitster
authored andcommitted
t7703: test --geometric repack with loose objects
We don't currently have a test that demonstrates the non-idempotent behavior of 'git repack --geometric' with loose objects, so add one here to make sure we don't regress in this area. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f25e33c commit dab3247

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

t/t7703-repack-geometric.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,37 @@ test_expect_success '--geometric with an intact progression' '
5454
)
5555
'
5656

57+
test_expect_success '--geometric with loose objects' '
58+
git init geometric &&
59+
test_when_finished "rm -fr geometric" &&
60+
(
61+
cd geometric &&
62+
63+
# These packs already form a geometric progression.
64+
test_commit_bulk --start=1 1 && # 3 objects
65+
test_commit_bulk --start=2 2 && # 6 objects
66+
# The loose objects are packed together, breaking the
67+
# progression.
68+
test_commit loose && # 3 objects
69+
70+
find $objdir/pack -name "*.pack" | sort >before &&
71+
git repack --geometric 2 -d &&
72+
find $objdir/pack -name "*.pack" | sort >after &&
73+
74+
comm -13 before after >new &&
75+
comm -23 before after >removed &&
76+
77+
test_line_count = 1 new &&
78+
test_must_be_empty removed &&
79+
80+
git repack --geometric 2 -d &&
81+
find $objdir/pack -name "*.pack" | sort >after &&
82+
83+
# The progression (3, 3, 6) is combined into one new pack.
84+
test_line_count = 1 after
85+
)
86+
'
87+
5788
test_expect_success '--geometric with small-pack rollup' '
5889
git init geometric &&
5990
test_when_finished "rm -fr geometric" &&

0 commit comments

Comments
 (0)