diff options
Diffstat (limited to 't/t5319-multi-pack-index.sh')
| -rwxr-xr-x | t/t5319-multi-pack-index.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index dd09134db0..ace5ac3b61 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -350,6 +350,29 @@ test_expect_success 'preferred packs must be non-empty' ' ) ' +test_expect_success 'preferred pack from existing MIDX without bitmaps' ' + git init preferred-without-bitmaps && + ( + cd preferred-without-bitmaps && + + test_commit one && + pack="$(git pack-objects --all $objdir/pack/pack </dev/null)" && + + git multi-pack-index write && + + # make another pack so that the subsequent MIDX write + # has something to do + test_commit two && + git repack -d && + + # write a new MIDX without bitmaps reusing the singular + # pack from the existing MIDX as the preferred pack in + # the new MIDX + git multi-pack-index write --preferred-pack=pack-$pack.pack + ) + +' + test_expect_success 'verify multi-pack-index success' ' git multi-pack-index verify --object-dir=$objdir ' @@ -1004,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" && |
