aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-07-23 16:54:33 -0700
committerJunio C Hamano <gitster@pobox.com>2024-07-23 16:54:33 -0700
commitec9d46588ec063685b4abfbe13dfd9da39c77d7c (patch)
tree5a95ec8d4b9ad7439fa2c3930e17bb03fcb487db /t
parentd19b6cd2dd72dc811f19df4b32c7ed223256c3ee (diff)
parent8fb6d11fade8301f0af1074fe250b9d79544cb18 (diff)
downloadgit-ec9d46588ec063685b4abfbe13dfd9da39c77d7c.tar.gz
Merge branch 'ds/midx-write-repack-fix'
Repacking a repository with multi-pack index started making stupid pack selections in Git 2.45, which has been corrected. * ds/midx-write-repack-fix: midx-write: revert use of --stdin-packs t5319: add failing test case for repack/expire
Diffstat (limited to 't')
-rwxr-xr-xt/t5319-multi-pack-index.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 10d2a6bf92..ace5ac3b61 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -1027,6 +1027,61 @@ test_expect_success 'repack --batch-size=<large> repacks everything' '
)
'
+test_expect_success 'repack/expire loop' '
+ git init repack-expire &&
+ test_when_finished "rm -fr repack-expire" &&
+ (
+ cd repack-expire &&
+
+ test_commit_bulk 5 &&
+
+ # Create three overlapping pack-files
+ git rev-list --objects HEAD~3 >in-1 &&
+ git rev-list --objects HEAD~4..HEAD~2 >in-2 &&
+ git rev-list --objects HEAD~3..HEAD >in-3 &&
+
+ # Create disconnected blobs
+ obj1=$(git hash-object -w in-1) &&
+ obj2=$(git hash-object -w in-2) &&
+ obj3=$(git hash-object -w in-3) &&
+
+ echo $obj2 >>in-2 &&
+ echo $obj3 >>in-3 &&
+
+ for i in $(test_seq 3)
+ do
+ git pack-objects .git/objects/pack/test-$i <in-$i \
+ || return 1
+ done &&
+
+ rm -fr .git/objects/pack/pack-* &&
+ git multi-pack-index write &&
+
+ for i in $(test_seq 3)
+ do
+ for file in $(ls .git/objects/pack/test-$i*)
+ do
+ test-tool chmtime =+$((3600*$i-25000)) $file || return 1
+ done || return 1
+ done &&
+
+ pack1=$(ls .git/objects/pack/test-1-*.pack) &&
+ pack2=$(ls .git/objects/pack/test-2-*.pack) &&
+ pack3=$(ls .git/objects/pack/test-3-*.pack) &&
+
+ # Prevent test-1 from being rewritten.
+ touch "${pack1%.pack}.keep" &&
+
+ # This repack-expire loop should repack all non-kept packs
+ # into a new pack and then delete the old packs.
+ git multi-pack-index repack &&
+ git multi-pack-index expire &&
+
+ test_path_is_missing $pack3 &&
+ test_path_is_missing $pack2
+ )
+'
+
test_expect_success 'load reverse index when missing .idx, .pack' '
git init repo &&
test_when_finished "rm -fr repo" &&