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 <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
Mar 5, 2021 at 10:21 UTC
dab324773422f38f8572185127a268813342805e
1 file changed
+31
t/t7703-repack-geometric.sh
+31
@@ -54,6 +54,37 @@ test_expect_success '--geometric with an intact progression' '
54
)
55
'
56
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
+
88
test_expect_success '--geometric with small-pack rollup' '
89
git init geometric &&
90
test_when_finished "rm -fr geometric" &&