git
[Ported from github.com/git/git] Sync with Git 2.56.1
Brought by drakestapleton
git / t / t5326-multi-pack-bitmaps.sh
| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='exercise basic multi-pack bitmap functionality' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | . "${TEST_DIRECTORY}/lib-bitmap.sh" |
| 7 | |
| 8 | # We'll be writing our own MIDX, so avoid getting confused by the |
| 9 | # automatic ones. |
| 10 | GIT_TEST_MULTI_PACK_INDEX=0 |
| 11 | GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL=0 |
| 12 | |
| 13 | # This test exercise multi-pack bitmap functionality where the object order is |
| 14 | # stored and read from a special chunk within the MIDX, so use the default |
| 15 | # behavior here. |
| 16 | sane_unset GIT_TEST_MIDX_WRITE_REV |
| 17 | sane_unset GIT_TEST_MIDX_READ_RIDX |
| 18 | |
| 19 | bitmap_reuse_tests() { |
| 20 | from=$1 |
| 21 | to=$2 |
| 22 | writeLookupTable=false |
| 23 | |
| 24 | for i in $3-${$#} |
| 25 | do |
| 26 | case $i in |
| 27 | "pack.writeBitmapLookupTable") writeLookupTable=true;; |
| 28 | esac |
| 29 | done |
| 30 | |
| 31 | test_expect_success "setup pack reuse tests ($from -> $to)" ' |
| 32 | rm -fr repo && |
| 33 | git init repo && |
| 34 | ( |
| 35 | cd repo && |
| 36 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 37 | test_commit_bulk 16 && |
| 38 | git tag old-tip && |
| 39 | |
| 40 | git config core.multiPackIndex true && |
| 41 | if test "MIDX" = "$from" |
| 42 | then |
| 43 | git repack -Ad && |
| 44 | git multi-pack-index write --bitmap |
| 45 | else |
| 46 | git repack -Adb |
| 47 | fi |
| 48 | ) |
| 49 | ' |
| 50 | |
| 51 | test_expect_success "build bitmap from existing ($from -> $to)" ' |
| 52 | ( |
| 53 | cd repo && |
| 54 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 55 | test_commit_bulk --id=further 16 && |
| 56 | git tag new-tip && |
| 57 | |
| 58 | if test "MIDX" = "$to" |
| 59 | then |
| 60 | git repack -d && |
| 61 | git multi-pack-index write --bitmap |
| 62 | else |
| 63 | git repack -Adb |
| 64 | fi |
| 65 | ) |
| 66 | ' |
| 67 | |
| 68 | test_expect_success "verify resulting bitmaps ($from -> $to)" ' |
| 69 | ( |
| 70 | cd repo && |
| 71 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 72 | git for-each-ref && |
| 73 | git rev-list --test-bitmap refs/tags/old-tip && |
| 74 | git rev-list --test-bitmap refs/tags/new-tip |
| 75 | ) |
| 76 | ' |
| 77 | } |
| 78 | |
| 79 | test_midx_bitmap_cases () { |
| 80 | writeLookupTable=false |
| 81 | writeBitmapLookupTable= |
| 82 | |
| 83 | for i in "$@" |
| 84 | do |
| 85 | case $i in |
| 86 | "pack.writeBitmapLookupTable") |
| 87 | writeLookupTable=true |
| 88 | writeBitmapLookupTable="$i" |
| 89 | ;; |
| 90 | esac |
| 91 | done |
| 92 | |
| 93 | test_expect_success 'setup test_repository' ' |
| 94 | rm -rf * .git && |
| 95 | git init && |
| 96 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 97 | git config maintenance.auto false |
| 98 | ' |
| 99 | |
| 100 | midx_bitmap_core |
| 101 | |
| 102 | bitmap_reuse_tests 'pack' 'MIDX' "$writeBitmapLookupTable" |
| 103 | bitmap_reuse_tests 'MIDX' 'pack' "$writeBitmapLookupTable" |
| 104 | bitmap_reuse_tests 'MIDX' 'MIDX' "$writeBitmapLookupTable" |
| 105 | |
| 106 | test_expect_success 'missing object closure fails gracefully' ' |
| 107 | rm -fr repo && |
| 108 | git init repo && |
| 109 | test_when_finished "rm -fr repo" && |
| 110 | ( |
| 111 | cd repo && |
| 112 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 113 | |
| 114 | test_commit loose && |
| 115 | test_commit packed && |
| 116 | |
| 117 | # Do not pass "--revs"; we want a pack without the "loose" |
| 118 | # commit. |
| 119 | git pack-objects $objdir/pack/pack <<-EOF && |
| 120 | $(git rev-parse packed) |
| 121 | EOF |
| 122 | |
| 123 | test_must_fail git multi-pack-index write --bitmap 2>err && |
| 124 | test_grep "doesn.t have full closure" err && |
| 125 | test_path_is_missing $midx |
| 126 | ) |
| 127 | ' |
| 128 | |
| 129 | midx_bitmap_partial_tests |
| 130 | |
| 131 | test_expect_success 'removing a MIDX clears stale bitmaps' ' |
| 132 | rm -fr repo && |
| 133 | git init repo && |
| 134 | test_when_finished "rm -fr repo" && |
| 135 | ( |
| 136 | cd repo && |
| 137 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 138 | test_commit base && |
| 139 | git repack && |
| 140 | git multi-pack-index write --bitmap && |
| 141 | |
| 142 | # Write a MIDX and bitmap; remove the MIDX but leave the bitmap. |
| 143 | stale_bitmap=$midx-$(midx_checksum $objdir).bitmap && |
| 144 | rm $midx && |
| 145 | |
| 146 | # Then write a new MIDX. |
| 147 | test_commit new && |
| 148 | git repack && |
| 149 | git multi-pack-index write --bitmap && |
| 150 | |
| 151 | test_path_is_file $midx && |
| 152 | test_path_is_file $midx-$(midx_checksum $objdir).bitmap && |
| 153 | test_path_is_missing $stale_bitmap |
| 154 | ) |
| 155 | ' |
| 156 | |
| 157 | test_expect_success 'pack.preferBitmapTips' ' |
| 158 | git init repo && |
| 159 | test_when_finished "rm -fr repo" && |
| 160 | ( |
| 161 | cd repo && |
| 162 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 163 | |
| 164 | test_commit_bulk --message="%s" 103 && |
| 165 | |
| 166 | git log --format="%H" >commits.raw && |
| 167 | sort <commits.raw >commits && |
| 168 | |
| 169 | git log --format="create refs/tags/%s %H" HEAD >refs && |
| 170 | git update-ref --stdin <refs && |
| 171 | |
| 172 | git multi-pack-index write --bitmap && |
| 173 | test_path_is_file $midx && |
| 174 | test_path_is_file $midx-$(midx_checksum $objdir).bitmap && |
| 175 | |
| 176 | test-tool bitmap list-commits | sort >bitmaps && |
| 177 | comm -13 bitmaps commits >before && |
| 178 | test_line_count = 1 before && |
| 179 | |
| 180 | sed "s|\(.*\)|create refs/tags/include/\1 \1|" before | |
| 181 | git update-ref --stdin && |
| 182 | |
| 183 | rm -fr $midx-$(midx_checksum $objdir).bitmap && |
| 184 | rm -fr $midx && |
| 185 | |
| 186 | git -c pack.preferBitmapTips=refs/tags/include \ |
| 187 | multi-pack-index write --bitmap && |
| 188 | test-tool bitmap list-commits | sort >bitmaps && |
| 189 | comm -13 bitmaps commits >after && |
| 190 | |
| 191 | ! test_cmp before after |
| 192 | ) |
| 193 | ' |
| 194 | |
| 195 | test_expect_success 'writing a bitmap with --refs-snapshot' ' |
| 196 | git init repo && |
| 197 | test_when_finished "rm -fr repo" && |
| 198 | ( |
| 199 | cd repo && |
| 200 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 201 | |
| 202 | test_commit one && |
| 203 | test_commit two && |
| 204 | |
| 205 | git rev-parse one >snapshot && |
| 206 | |
| 207 | git repack -ad && |
| 208 | |
| 209 | # First, write a MIDX which see both refs/tags/one and |
| 210 | # refs/tags/two (causing both of those commits to receive |
| 211 | # bitmaps). |
| 212 | git multi-pack-index write --bitmap && |
| 213 | |
| 214 | test_path_is_file $midx && |
| 215 | test_path_is_file $midx-$(midx_checksum $objdir).bitmap && |
| 216 | |
| 217 | test-tool bitmap list-commits | sort >bitmaps && |
| 218 | test_grep "$(git rev-parse one)" bitmaps && |
| 219 | test_grep "$(git rev-parse two)" bitmaps && |
| 220 | |
| 221 | rm -fr $midx-$(midx_checksum $objdir).bitmap && |
| 222 | rm -fr $midx && |
| 223 | |
| 224 | # Then again, but with a refs snapshot which only sees |
| 225 | # refs/tags/one. |
| 226 | git multi-pack-index write --bitmap --refs-snapshot=snapshot && |
| 227 | |
| 228 | test_path_is_file $midx && |
| 229 | test_path_is_file $midx-$(midx_checksum $objdir).bitmap && |
| 230 | |
| 231 | test-tool bitmap list-commits | sort >bitmaps && |
| 232 | test_grep "$(git rev-parse one)" bitmaps && |
| 233 | test_grep ! "$(git rev-parse two)" bitmaps |
| 234 | ) |
| 235 | ' |
| 236 | |
| 237 | test_expect_success 'write a bitmap with --refs-snapshot (preferred tips)' ' |
| 238 | git init repo && |
| 239 | test_when_finished "rm -fr repo" && |
| 240 | ( |
| 241 | cd repo && |
| 242 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 243 | |
| 244 | test_commit_bulk --message="%s" 103 && |
| 245 | |
| 246 | git log --format="%H" >commits.raw && |
| 247 | sort <commits.raw >commits && |
| 248 | |
| 249 | git log --format="create refs/tags/%s %H" HEAD >refs && |
| 250 | git update-ref --stdin <refs && |
| 251 | |
| 252 | git multi-pack-index write --bitmap && |
| 253 | test_path_is_file $midx && |
| 254 | test_path_is_file $midx-$(midx_checksum $objdir).bitmap && |
| 255 | |
| 256 | test-tool bitmap list-commits | sort >bitmaps && |
| 257 | comm -13 bitmaps commits >before && |
| 258 | test_line_count = 1 before && |
| 259 | |
| 260 | ( |
| 261 | grep -vf before commits.raw && # lint-ok: data filter |
| 262 | # mark missing commits as preferred |
| 263 | sed "s/^/+/" before |
| 264 | ) >snapshot && |
| 265 | |
| 266 | rm -fr $midx-$(midx_checksum $objdir).bitmap && |
| 267 | rm -fr $midx && |
| 268 | |
| 269 | git multi-pack-index write --bitmap --refs-snapshot=snapshot && |
| 270 | test-tool bitmap list-commits | sort >bitmaps && |
| 271 | comm -13 bitmaps commits >after && |
| 272 | |
| 273 | ! test_cmp before after |
| 274 | ) |
| 275 | ' |
| 276 | |
| 277 | test_expect_success 'hash-cache values are propagated from pack bitmaps' ' |
| 278 | rm -fr repo && |
| 279 | git init repo && |
| 280 | test_when_finished "rm -fr repo" && |
| 281 | ( |
| 282 | cd repo && |
| 283 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 284 | |
| 285 | test_commit base && |
| 286 | test_commit base2 && |
| 287 | git repack -adb && |
| 288 | |
| 289 | test-tool bitmap dump-hashes >pack.raw && |
| 290 | test_file_not_empty pack.raw && |
| 291 | sort pack.raw >pack.hashes && |
| 292 | |
| 293 | test_commit new && |
| 294 | git repack && |
| 295 | git multi-pack-index write --bitmap && |
| 296 | |
| 297 | test-tool bitmap dump-hashes >midx.raw && |
| 298 | sort midx.raw >midx.hashes && |
| 299 | |
| 300 | # ensure that every namehash in the pack bitmap can be found in |
| 301 | # the midx bitmap (i.e., that there are no oid-namehash pairs |
| 302 | # unique to the pack bitmap). |
| 303 | comm -23 pack.hashes midx.hashes >dropped.hashes && |
| 304 | test_must_be_empty dropped.hashes |
| 305 | ) |
| 306 | ' |
| 307 | |
| 308 | test_expect_success 'no MIDX or .bitmap is written without any objects' ' |
| 309 | rm -fr repo && |
| 310 | git init repo && |
| 311 | test_when_finished "rm -fr repo" && |
| 312 | ( |
| 313 | cd repo && |
| 314 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 315 | |
| 316 | empty="$(git pack-objects $objdir/pack/pack </dev/null)" && |
| 317 | cat >packs <<-EOF && |
| 318 | pack-$empty.idx |
| 319 | EOF |
| 320 | |
| 321 | git multi-pack-index write --bitmap --stdin-packs \ |
| 322 | <packs && |
| 323 | |
| 324 | test_path_is_missing $midx |
| 325 | ) |
| 326 | ' |
| 327 | |
| 328 | test_expect_success 'graceful fallback when missing reverse index' ' |
| 329 | rm -fr repo && |
| 330 | git init repo && |
| 331 | test_when_finished "rm -fr repo" && |
| 332 | ( |
| 333 | cd repo && |
| 334 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && |
| 335 | |
| 336 | test_commit base && |
| 337 | |
| 338 | # write a pack and MIDX bitmap containing base |
| 339 | git repack -adb && |
| 340 | git multi-pack-index write --bitmap && |
| 341 | |
| 342 | GIT_TEST_MIDX_READ_RIDX=0 \ |
| 343 | git rev-list --use-bitmap-index HEAD 2>err && |
| 344 | test_grep ! "ignoring extra bitmap file" err |
| 345 | ) |
| 346 | ' |
| 347 | } |
| 348 | |
| 349 | test_midx_bitmap_cases |
| 350 | |
| 351 | test_midx_bitmap_cases "pack.writeBitmapLookupTable" |
| 352 | |
| 353 | test_expect_success 'multi-pack-index write writes lookup table if enabled' ' |
| 354 | rm -fr repo && |
| 355 | git init repo && |
| 356 | test_when_finished "rm -fr repo" && |
| 357 | ( |
| 358 | cd repo && |
| 359 | test_commit base && |
| 360 | git config pack.writeBitmapLookupTable true && |
| 361 | git repack -ad && |
| 362 | GIT_TRACE2_EVENT="$(pwd)/trace" \ |
| 363 | git multi-pack-index write --bitmap && |
| 364 | test_grep "\"label\":\"writing_lookup_table\"" trace |
| 365 | ) |
| 366 | ' |
| 367 | |
| 368 | test_expect_success 'preferred pack change with existing MIDX bitmap' ' |
| 369 | git init preferred-pack-with-existing && |
| 370 | ( |
| 371 | cd preferred-pack-with-existing && |
| 372 | |
| 373 | test_commit base && |
| 374 | test_commit other && |
| 375 | |
| 376 | git rev-list --objects --no-object-names base >p1.objects && |
| 377 | git rev-list --objects --no-object-names other >p2.objects && |
| 378 | |
| 379 | p1="$(git pack-objects "$objdir/pack/pack" \ |
| 380 | --delta-base-offset <p1.objects)" && |
| 381 | p2="$(git pack-objects "$objdir/pack/pack" \ |
| 382 | --delta-base-offset <p2.objects)" && |
| 383 | |
| 384 | # Generate a MIDX containing the first two packs, |
| 385 | # marking p1 as preferred, and ensure that it can be |
| 386 | # successfully cloned. |
| 387 | git multi-pack-index write --bitmap \ |
| 388 | --preferred-pack="pack-$p1.pack" && |
| 389 | test_path_is_file $midx && |
| 390 | test_path_is_file $midx-$(midx_checksum $objdir).bitmap && |
| 391 | git clone --no-local . clone1 && |
| 392 | |
| 393 | # Then generate a new pack which sorts ahead of any |
| 394 | # existing pack (by tweaking the pack prefix). |
| 395 | test_commit foo && |
| 396 | git pack-objects --all --unpacked $objdir/pack/pack0 && |
| 397 | |
| 398 | # Generate a new MIDX which changes the preferred pack |
| 399 | # to a pack contained in the existing MIDX. |
| 400 | git multi-pack-index write --bitmap \ |
| 401 | --preferred-pack="pack-$p2.pack" && |
| 402 | test_path_is_file $midx && |
| 403 | test_path_is_file $midx-$(midx_checksum $objdir).bitmap && |
| 404 | |
| 405 | # When the above circumstances are met, the preferred |
| 406 | # pack should change appropriately and clones should |
| 407 | # (still) succeed. |
| 408 | git clone --no-local . clone2 |
| 409 | ) |
| 410 | ' |
| 411 | |
| 412 | test_expect_success 'tagged commits are selected for bitmapping' ' |
| 413 | rm -fr repo && |
| 414 | git init repo && |
| 415 | test_when_finished "rm -fr repo" && |
| 416 | ( |
| 417 | cd repo && |
| 418 | |
| 419 | test_commit --annotate base && |
| 420 | git repack -d && |
| 421 | |
| 422 | # Remove refs/heads/main which points at the commit directly, |
| 423 | # leaving only a reference to the annotated tag. |
| 424 | git branch -M main && |
| 425 | git checkout base && |
| 426 | git branch -d main && |
| 427 | |
| 428 | git multi-pack-index write --bitmap && |
| 429 | |
| 430 | git rev-parse HEAD >want && |
| 431 | test-tool bitmap list-commits >actual && |
| 432 | test_grep $(cat want) actual |
| 433 | ) |
| 434 | ' |
| 435 | |
| 436 | test_expect_success 'do not follow replace objects for MIDX bitmap' ' |
| 437 | rm -fr repo && |
| 438 | git init repo && |
| 439 | test_when_finished "rm -fr repo" && |
| 440 | ( |
| 441 | cd repo && |
| 442 | |
| 443 | test_commit A && |
| 444 | test_commit B && |
| 445 | git checkout --orphan=orphan A && |
| 446 | test_commit orphan && |
| 447 | |
| 448 | git replace A HEAD && |
| 449 | git repack -ad --write-midx --write-bitmap-index && |
| 450 | |
| 451 | # generating reachability bitmaps with replace refs |
| 452 | # enabled will result in broken clones |
| 453 | git clone --no-local --bare . clone.git |
| 454 | ) |
| 455 | ' |
| 456 | |
| 457 | corrupt_file () { |
| 458 | chmod a+w "$1" && |
| 459 | printf "bogus" | dd of="$1" bs=1 seek="12" conv=notrunc |
| 460 | } |
| 461 | |
| 462 | test_expect_success 'git fsck correctly identifies good and bad bitmaps' ' |
| 463 | git init valid && |
| 464 | test_when_finished rm -rf valid && |
| 465 | |
| 466 | test_commit_bulk 20 && |
| 467 | git repack -adbf && |
| 468 | |
| 469 | # Move pack-bitmap aside so it is not deleted |
| 470 | # in next repack. |
| 471 | packbitmap=$(ls .git/objects/pack/pack-*.bitmap) && |
| 472 | mv "$packbitmap" "$packbitmap.bak" && |
| 473 | |
| 474 | test_commit_bulk 10 && |
| 475 | git repack -b --write-midx && |
| 476 | midxbitmap=$(ls .git/objects/pack/multi-pack-index-*.bitmap) && |
| 477 | |
| 478 | # Copy MIDX bitmap to backup. Copy pack bitmap from backup. |
| 479 | cp "$midxbitmap" "$midxbitmap.bak" && |
| 480 | cp "$packbitmap.bak" "$packbitmap" && |
| 481 | |
| 482 | # fsck works at first |
| 483 | git fsck 2>err && |
| 484 | test_must_be_empty err && |
| 485 | |
| 486 | corrupt_file "$packbitmap" && |
| 487 | test_must_fail git fsck 2>err && |
| 488 | test_grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err && |
| 489 | |
| 490 | cp "$packbitmap.bak" "$packbitmap" && |
| 491 | corrupt_file "$midxbitmap" && |
| 492 | test_must_fail git fsck 2>err && |
| 493 | test_grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err && |
| 494 | |
| 495 | corrupt_file "$packbitmap" && |
| 496 | test_must_fail git fsck 2>err && |
| 497 | test_grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err && |
| 498 | test_grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err && |
| 499 | |
| 500 | # The bitmap checks are performed with "--no-full", but not with |
| 501 | # "--connectivity-only". |
| 502 | test_must_fail git fsck --no-full 2>err && |
| 503 | test_grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err && |
| 504 | test_grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err && |
| 505 | git fsck --connectivity-only 2>err && |
| 506 | test_grep ! "invalid checksum" err |
| 507 | ' |
| 508 | |
| 509 | test_expect_success 'corrupt MIDX with bitmap causes fallback' ' |
| 510 | git init corrupt-midx-bitmap && |
| 511 | ( |
| 512 | cd corrupt-midx-bitmap && |
| 513 | |
| 514 | test_commit first && |
| 515 | git repack -d && |
| 516 | test_commit second && |
| 517 | git repack -d && |
| 518 | |
| 519 | git multi-pack-index write --bitmap && |
| 520 | checksum=$(midx_checksum $objdir) && |
| 521 | for f in $midx $midx-$checksum.bitmap |
| 522 | do |
| 523 | mv $f $f.bak || return 1 |
| 524 | done && |
| 525 | |
| 526 | # pack everything together, invalidating the MIDX |
| 527 | git repack -ad && |
| 528 | # then restore the now-stale MIDX |
| 529 | for f in $midx $midx-$checksum.bitmap |
| 530 | do |
| 531 | mv $f.bak $f || return 1 |
| 532 | done && |
| 533 | |
| 534 | git rev-list --count --objects --use-bitmap-index HEAD >out 2>err && |
| 535 | # should attempt opening the broken pack twice (once |
| 536 | # from the attempt to load it via the stale bitmap, and |
| 537 | # again when attempting to load it from the stale MIDX) |
| 538 | # before falling back to the non-MIDX case |
| 539 | test 2 -eq $(grep -c "could not open pack" err) && |
| 540 | test 6 -eq $(cat out) |
| 541 | ) |
| 542 | ' |
| 543 | |
| 544 | for allow_pack_reuse in single multi |
| 545 | do |
| 546 | test_expect_success "reading MIDX without BTMP chunk does not complain with $allow_pack_reuse pack reuse" ' |
| 547 | test_when_finished "rm -rf midx-without-btmp" && |
| 548 | git init midx-without-btmp && |
| 549 | ( |
| 550 | cd midx-without-btmp && |
| 551 | test_commit initial && |
| 552 | |
| 553 | git repack -Adbl --write-bitmap-index --write-midx && |
| 554 | GIT_TEST_MIDX_READ_BTMP=false git -c pack.allowPackReuse=$allow_pack_reuse \ |
| 555 | pack-objects --all --use-bitmap-index --stdout </dev/null >/dev/null 2>err && |
| 556 | test_must_be_empty err |
| 557 | ) |
| 558 | ' |
| 559 | done |
| 560 | |
| 561 | test_expect_success 'remove one packfile between MIDX bitmap writes' ' |
| 562 | git init remove-pack-between-writes && |
| 563 | ( |
| 564 | cd remove-pack-between-writes && |
| 565 | |
| 566 | test_commit A && |
| 567 | test_commit B && |
| 568 | test_commit C && |
| 569 | |
| 570 | # Create packs with the prefix "pack-A", "pack-B", |
| 571 | # "pack-C" to impose a lexicographic order on these |
| 572 | # packs so the pack being removed is always from the |
| 573 | # middle. |
| 574 | packdir=.git/objects/pack && |
| 575 | A="$(echo A | git pack-objects $packdir/pack-A --revs)" && |
| 576 | B="$(echo B | git pack-objects $packdir/pack-B --revs)" && |
| 577 | C="$(echo C | git pack-objects $packdir/pack-C --revs)" && |
| 578 | |
| 579 | git multi-pack-index write --bitmap && |
| 580 | |
| 581 | cat >in <<-EOF && |
| 582 | pack-A-$A.idx |
| 583 | pack-C-$C.idx |
| 584 | EOF |
| 585 | git multi-pack-index write --bitmap --stdin-packs <in && |
| 586 | |
| 587 | git rev-list --test-bitmap HEAD |
| 588 | ) |
| 589 | ' |
| 590 | |
| 591 | test_done |