]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7704: demonstrate failure with once-cruft objects above the geometric split
authorTaylor Blau <me@ttaylorr.com>
Fri, 27 Mar 2026 20:06:49 +0000 (16:06 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Mar 2026 20:40:39 +0000 (13:40 -0700)
Add a test demonstrating a case where geometric repacking fails to
produce a pack with full object closure, thus making it impossible to
write a reachability bitmap.

Mark the test with 'test_expect_failure' for now. The subsequent commit
will explain the precise failure mode, and implement a fix.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7704-repack-cruft.sh

index aa2e2e6ad887f282b6a2ec846bc32e60da8c8ac9..77133395b5d0cc56037e848a96f296dc1375085e 100755 (executable)
@@ -869,4 +869,26 @@ test_expect_success 'repack --write-midx includes cruft when already geometric'
        )
 '
 
+test_expect_failure 'repack rescues once-cruft objects above geometric split' '
+       git config repack.midxMustContainCruft false &&
+
+       test_commit reachable &&
+       test_commit unreachable &&
+
+       unreachable="$(git rev-parse HEAD)" &&
+
+       git reset --hard HEAD^ &&
+       git tag -d unreachable &&
+       git reflog expire --all --expire=all &&
+
+       git repack --cruft -d &&
+
+       echo $unreachable | git pack-objects .git/objects/pack/pack &&
+
+       test_commit new &&
+
+       git update-ref refs/heads/other $unreachable &&
+       git repack --geometric=2 -d --write-midx --write-bitmap-index
+'
+
 test_done