Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1410-reflog.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1410-reflog.sh` 796 lines ยท 20679 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2007 Junio C Hamano 4 # 5 6 test_description='Test prune and reflog expiration' 7 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 8 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 9 10 . ./test-lib.sh 11 12 check_have () { 13 gaah= && 14 for N in "$@" 15 do 16 eval "o=\$$N" && git cat-file -t $o || { 17 echo Gaah $N 18 gaah=$N 19 break 20 } 21 done && 22 test -z "$gaah" 23 } 24 25 check_fsck () { 26 git fsck --full >fsck.output 27 case "$1" in 28 '') 29 test_must_be_empty fsck.output ;; 30 *) 31 test_grep "$1" fsck.output ;; 32 esac 33 } 34 35 corrupt () { 36 mv .git/objects/$(test_oid_to_path $1) .git/$1 37 } 38 39 recover () { 40 aa=$(echo $1 | cut -c 1-2) 41 mkdir -p .git/objects/$aa 42 mv .git/$1 .git/objects/$(test_oid_to_path $1) 43 } 44 45 check_dont_have () { 46 gaah= && 47 for N in "$@" 48 do 49 eval "o=\$$N" 50 git cat-file -t $o && { 51 echo Gaah $N 52 gaah=$N 53 break 54 } 55 done 56 test -z "$gaah" 57 } 58 59 test_expect_success setup ' 60 mkdir -p A/B && 61 echo rat >C && 62 echo ox >A/D && 63 echo tiger >A/B/E && 64 git add . && 65 66 test_tick && git commit -m rabbit && 67 H=$(git rev-parse --verify HEAD) && 68 A=$(git rev-parse --verify HEAD:A) && 69 B=$(git rev-parse --verify HEAD:A/B) && 70 C=$(git rev-parse --verify HEAD:C) && 71 D=$(git rev-parse --verify HEAD:A/D) && 72 E=$(git rev-parse --verify HEAD:A/B/E) && 73 check_fsck && 74 75 test_chmod +x C && 76 git add C && 77 test_tick && git commit -m dragon && 78 L=$(git rev-parse --verify HEAD) && 79 check_fsck && 80 81 rm -f C A/B/E && 82 echo snake >F && 83 echo horse >A/G && 84 git add F A/G && 85 test_tick && git commit -a -m sheep && 86 F=$(git rev-parse --verify HEAD:F) && 87 G=$(git rev-parse --verify HEAD:A/G) && 88 I=$(git rev-parse --verify HEAD:A) && 89 J=$(git rev-parse --verify HEAD) && 90 check_fsck && 91 92 rm -f A/G && 93 test_tick && git commit -a -m monkey && 94 K=$(git rev-parse --verify HEAD) && 95 check_fsck && 96 97 check_have A B C D E F G H I J K L && 98 99 git prune && 100 101 check_have A B C D E F G H I J K L && 102 103 check_fsck && 104 105 git reflog refs/heads/main >output && 106 test_line_count = 4 output 107 ' 108 109 test_expect_success 'correct usage on sub-command -h' ' 110 git reflog expire -h >err && 111 test_grep "git reflog expire" err 112 ' 113 114 test_expect_success 'correct usage on "git reflog show -h"' ' 115 git reflog show -h >err && 116 test_grep -F "git reflog [show]" err 117 ' 118 119 test_expect_success 'pass through -- to sub-command' ' 120 test_when_finished "rm -rf repo" && 121 git init repo && 122 test_commit -C repo message --a-file contents dash-tag && 123 124 git -C repo reflog show -- --does-not-exist >out && 125 test_must_be_empty out && 126 git -C repo reflog show >expect && 127 git -C repo reflog show -- --a-file >actual && 128 test_cmp expect actual 129 ' 130 131 test_expect_success rewind ' 132 test_tick && git reset --hard HEAD~2 && 133 test_path_is_file C && 134 test_path_is_file A/B/E && 135 test_path_is_missing F && 136 test_path_is_missing A/G && 137 138 check_have A B C D E F G H I J K L && 139 140 git prune && 141 142 check_have A B C D E F G H I J K L && 143 144 git reflog refs/heads/main >output && 145 test_line_count = 5 output 146 ' 147 148 test_expect_success 'reflog expire should not barf on an annotated tag' ' 149 test_when_finished "git tag -d v0.tag || :" && 150 git -c core.logAllRefUpdates=always \ 151 tag -a -m "tag name" v0.tag main && 152 git reflog expire --dry-run refs/tags/v0.tag 2>err && 153 test_grep ! "error: [Oo]bject .* not a commit" err 154 ' 155 156 test_expect_success 'reflog expire keeps reachable entries for 90 days' ' 157 test_when_finished "rm -rf reachable-keep" && 158 git init reachable-keep && 159 ( 160 cd reachable-keep && 161 timestamp=$(test-tool date timestamp "60.days.ago") && 162 timestamp=${timestamp#* -> } && 163 test_commit --no-tag --date "$timestamp +0000" old && 164 git reflog expire --all && 165 test_stdout_line_count = 1 git reflog refs/heads/main 166 ) 167 ' 168 169 test_expect_success 'reflog expire removes reachable entries after 90 days' ' 170 test_when_finished "rm -rf reachable-expire" && 171 git init reachable-expire && 172 ( 173 cd reachable-expire && 174 timestamp=$(test-tool date timestamp "100.days.ago") && 175 timestamp=${timestamp#* -> } && 176 test_commit --no-tag --date "$timestamp +0000" old && 177 git reflog expire --all && 178 test_stdout_line_count = 0 git reflog refs/heads/main 179 ) 180 ' 181 182 test_expect_success 'reflog expire keeps unreachable entries for 30 days' ' 183 test_when_finished "rm -rf unreachable-keep" && 184 git init unreachable-keep && 185 ( 186 cd unreachable-keep && 187 test_commit --no-tag base && 188 base=$(git rev-parse HEAD) && 189 timestamp=$(test-tool date timestamp "20.days.ago") && 190 timestamp=${timestamp#* -> } && 191 test_commit --no-tag --date "$timestamp +0000" old && 192 old=$(git rev-parse HEAD) && 193 git update-ref refs/heads/main "$base" && 194 git rev-list --all --objects >reachable && 195 test_grep ! "$old" reachable && 196 git reflog expire --all && 197 git reflog --format='%H' refs/heads/main >actual && 198 test_grep "$old" actual 199 ) 200 ' 201 202 test_expect_success 'reflog expire removes unreachable entries after 30 days' ' 203 test_when_finished "rm -rf unreachable-expire" && 204 git init unreachable-expire && 205 ( 206 cd unreachable-expire && 207 test_commit --no-tag base && 208 base=$(git rev-parse HEAD) && 209 timestamp=$(test-tool date timestamp "40.days.ago") && 210 timestamp=${timestamp#* -> } && 211 test_commit --no-tag --date "$timestamp +0000" old && 212 old=$(git rev-parse HEAD) && 213 git update-ref refs/heads/main "$base" && 214 git rev-list --all --objects >reachable && 215 test_grep ! "$old" reachable && 216 git reflog expire --all && 217 git reflog --format='%H' refs/heads/main >actual && 218 test_grep ! "$old" actual 219 ) 220 ' 221 222 test_expect_success 'corrupt and check' ' 223 224 corrupt $F && 225 check_fsck "missing blob $F" 226 227 ' 228 229 test_expect_success 'reflog expire --dry-run should not touch reflog' ' 230 231 git reflog expire --dry-run \ 232 --expire=$(($test_tick - 10000)) \ 233 --expire-unreachable=$(($test_tick - 10000)) \ 234 --stale-fix \ 235 --all && 236 237 git reflog refs/heads/main >output && 238 test_line_count = 5 output && 239 240 check_fsck "missing blob $F" 241 ' 242 243 # A dry run only ever says "keep" or "would prune". 244 check_dry_run_output () { 245 test_grep "^would prune " "$1" && 246 sed -e "/^keep /d" -e "/^would prune /d" \ 247 -e "/^Marking reachable objects/d" "$1" >unexpected && 248 test_must_be_empty unexpected 249 } 250 251 test_expect_success 'reflog expire --dry-run --verbose with a named ref' ' 252 git reflog refs/heads/main >before && 253 git reflog expire --dry-run --verbose \ 254 --expire=$(($test_tick - 10000)) \ 255 --expire-unreachable=$(($test_tick - 10000)) \ 256 --stale-fix \ 257 refs/heads/main >output && 258 check_dry_run_output output && 259 260 git reflog refs/heads/main >after && 261 test_cmp before after 262 ' 263 264 test_expect_success 'reflog expire --dry-run --verbose --all' ' 265 git reflog refs/heads/main >before && 266 git reflog expire --dry-run --verbose \ 267 --expire=$(($test_tick - 10000)) \ 268 --expire-unreachable=$(($test_tick - 10000)) \ 269 --stale-fix \ 270 --all >output && 271 check_dry_run_output output && 272 273 git reflog refs/heads/main >after && 274 test_cmp before after 275 ' 276 277 test_expect_success 'reflog expire' ' 278 279 git reflog expire --verbose \ 280 --expire=$(($test_tick - 10000)) \ 281 --expire-unreachable=$(($test_tick - 10000)) \ 282 --stale-fix \ 283 --all && 284 285 git reflog refs/heads/main >output && 286 test_line_count = 2 output && 287 288 check_fsck "dangling commit $K" 289 ' 290 291 test_expect_success '--stale-fix handles missing objects generously' ' 292 git -c core.logAllRefUpdates=false fast-import --date-format=now <<-EOS && 293 commit refs/heads/stale-fix 294 mark :1 295 committer Author now 296 data < now 305 data < C && 336 test_tick && 337 git commit -m rat C && 338 339 echo 2 > C && 340 test_tick && 341 git commit -m ox C && 342 343 echo 3 > C && 344 test_tick && 345 git commit -m tiger C && 346 347 test_stdout_line_count = 5 git reflog && 348 test_stdout_line_count = 5 git reflog show main && 349 350 git reflog delete main@{1} && 351 test_stdout_line_count = 4 git reflog show main && 352 test_stdout_line_count = 5 git reflog && 353 git reflog show main > output && 354 ! grep ox < output && 355 356 git reflog delete HEAD@{1} && 357 test_stdout_line_count = 4 git reflog && 358 test_stdout_line_count = 4 git reflog show main && 359 360 git reflog delete main@{07.04.2005.15:15:00.-0700} && 361 test_stdout_line_count = 3 git reflog show main && 362 git reflog show main > output && 363 ! grep dragon < output 364 365 ' 366 367 test_expect_success 'rewind2' ' 368 369 test_tick && git reset --hard HEAD~2 && 370 git reflog refs/heads/main >output && 371 test_line_count = 4 output 372 ' 373 374 test_expect_success '--expire=never' ' 375 376 git reflog expire --verbose \ 377 --expire=never \ 378 --expire-unreachable=never \ 379 --all && 380 git reflog refs/heads/main >output && 381 test_line_count = 4 output 382 ' 383 384 test_expect_success 'gc.reflogexpire=never' ' 385 test_config gc.reflogexpire never && 386 test_config gc.reflogexpireunreachable never && 387 388 git reflog expire --verbose --all >output && 389 test_line_count = 9 output && 390 391 git reflog refs/heads/main >output && 392 test_line_count = 4 output 393 ' 394 395 test_expect_success 'gc.reflogexpire=false' ' 396 test_config gc.reflogexpire false && 397 test_config gc.reflogexpireunreachable false && 398 399 git reflog expire --verbose --all && 400 git reflog refs/heads/main >output && 401 test_line_count = 4 output 402 403 ' 404 405 test_expect_success 'git reflog expire unknown reference' ' 406 test_config gc.reflogexpire never && 407 test_config gc.reflogexpireunreachable never && 408 409 test_must_fail git reflog expire main@{123} 2>stderr && 410 test_grep "error: reflog could not be found: ${SQ}main@{123}${SQ}" stderr && 411 test_must_fail git reflog expire does-not-exist 2>stderr && 412 test_grep "error: reflog could not be found: ${SQ}does-not-exist${SQ}" stderr 413 ' 414 415 test_expect_success 'checkout should not delete log for packed ref' ' 416 test_stdout_line_count = 4 git reflog main && 417 git branch foo && 418 git pack-refs --all && 419 git checkout foo && 420 test_stdout_line_count = 4 git reflog main 421 ' 422 423 test_expect_success 'stale dirs do not cause d/f conflicts (reflogs on)' ' 424 test_when_finished "git branch -d one || git branch -d one/two" && 425 426 git branch one/two main && 427 echo "one/two@{0} branch: Created from main" >expect && 428 git log -g --format="%gd %gs" one/two >actual && 429 test_cmp expect actual && 430 git branch -d one/two && 431 432 # now logs/refs/heads/one is a stale directory, but 433 # we should move it out of the way to create "one" reflog 434 git branch one main && 435 echo "one@{0} branch: Created from main" >expect && 436 git log -g --format="%gd %gs" one >actual && 437 test_cmp expect actual 438 ' 439 440 test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' ' 441 test_when_finished "git branch -d one || git branch -d one/two" && 442 443 git branch one/two main && 444 echo "one/two@{0} branch: Created from main" >expect && 445 git log -g --format="%gd %gs" one/two >actual && 446 test_cmp expect actual && 447 git branch -d one/two && 448 449 # same as before, but we only create a reflog for "one" if 450 # it already exists, which it does not 451 git -c core.logallrefupdates=false branch one main && 452 git log -g --format="%gd %gs" one >actual && 453 test_must_be_empty actual 454 ' 455 456 test_expect_success 'no segfaults for reflog containing non-commit sha1s' ' 457 git update-ref --create-reflog -m "Creating ref" \ 458 refs/tests/tree-in-reflog HEAD && 459 git update-ref -m "Forcing tree" refs/tests/tree-in-reflog HEAD^{tree} && 460 git update-ref -m "Restoring to commit" refs/tests/tree-in-reflog HEAD && 461 git reflog refs/tests/tree-in-reflog 462 ' 463 464 test_expect_failure 'reflog with non-commit entries displays all entries' ' 465 git reflog refs/tests/tree-in-reflog >actual && 466 test_line_count = 3 actual 467 ' 468 469 test_expect_success 'continue walking past root commits' ' 470 git init orphanage && 471 ( 472 cd orphanage && 473 cat >expect <<-\EOF && 474 HEAD@{0} commit (initial): orphan2-1 475 HEAD@{1} commit: orphan1-2 476 HEAD@{2} commit (initial): orphan1-1 477 HEAD@{3} commit (initial): initial 478 EOF 479 test_commit initial && 480 git checkout --orphan orphan1 && 481 test_commit orphan1-1 && 482 test_commit orphan1-2 && 483 git checkout --orphan orphan2 && 484 test_commit orphan2-1 && 485 git log -g --format="%gd %gs" >actual && 486 test_cmp expect actual 487 ) 488 ' 489 490 test_expect_success 'expire with multiple worktrees' ' 491 git init main-wt && 492 ( 493 cd main-wt && 494 test_tick && 495 test_commit foo && 496 git worktree add link-wt && 497 test_tick && 498 test_commit -C link-wt foobar && 499 test_tick && 500 git reflog expire --verbose --all --expire=$test_tick && 501 test-tool ref-store worktree:link-wt for-each-reflog-ent HEAD >actual && 502 test_must_be_empty actual 503 ) 504 ' 505 506 test_expect_success 'expire one of multiple worktrees' ' 507 git init main-wt2 && 508 ( 509 cd main-wt2 && 510 test_tick && 511 test_commit foo && 512 git worktree add link-wt && 513 test_tick && 514 test_commit -C link-wt foobar && 515 test_tick && 516 test-tool ref-store worktree:link-wt for-each-reflog-ent HEAD \ 517 >expect-link-wt && 518 git reflog expire --verbose --all --expire=$test_tick \ 519 --single-worktree && 520 test-tool ref-store worktree:main for-each-reflog-ent HEAD \ 521 >actual-main && 522 test-tool ref-store worktree:link-wt for-each-reflog-ent HEAD \ 523 >actual-link-wt && 524 test_must_be_empty actual-main && 525 test_cmp expect-link-wt actual-link-wt 526 ) 527 ' 528 529 test_expect_success 'empty reflog' ' 530 test_when_finished "rm -rf empty" && 531 git init empty && 532 test_commit -C empty A && 533 test-tool ref-store main create-reflog refs/heads/foo && 534 git -C empty reflog expire --all 2>err && 535 test_must_be_empty err 536 ' 537 538 test_expect_success 'list reflogs' ' 539 test_when_finished "rm -rf repo" && 540 git init repo && 541 ( 542 cd repo && 543 git reflog list >actual && 544 test_must_be_empty actual && 545 546 test_commit A && 547 cat >expect <<-EOF && 548 HEAD 549 refs/heads/main 550 EOF 551 git reflog list >actual && 552 test_cmp expect actual && 553 554 git branch b && 555 cat >expect <<-EOF && 556 HEAD 557 refs/heads/b 558 refs/heads/main 559 EOF 560 git reflog list >actual && 561 test_cmp expect actual 562 ) 563 ' 564 565 test_expect_success 'list reflogs with worktree' ' 566 test_when_finished "rm -rf repo" && 567 git init repo && 568 ( 569 cd repo && 570 571 test_commit A && 572 git worktree add wt && 573 git -c core.logAllRefUpdates=always \ 574 update-ref refs/worktree/main HEAD && 575 git -c core.logAllRefUpdates=always \ 576 update-ref refs/worktree/per-worktree HEAD && 577 git -c core.logAllRefUpdates=always -C wt \ 578 update-ref refs/worktree/per-worktree HEAD && 579 git -c core.logAllRefUpdates=always -C wt \ 580 update-ref refs/worktree/worktree HEAD && 581 582 cat >expect <<-EOF && 583 HEAD 584 refs/heads/main 585 refs/heads/wt 586 refs/worktree/main 587 refs/worktree/per-worktree 588 EOF 589 git reflog list >actual && 590 test_cmp expect actual && 591 592 cat >expect <<-EOF && 593 HEAD 594 refs/heads/main 595 refs/heads/wt 596 refs/worktree/per-worktree 597 refs/worktree/worktree 598 EOF 599 git -C wt reflog list >actual && 600 test_cmp expect actual 601 ) 602 ' 603 604 test_expect_success 'reflog list returns error with additional args' ' 605 cat >expect <<-EOF && 606 error: list does not accept arguments: ${SQ}bogus${SQ} 607 EOF 608 test_must_fail git reflog list bogus 2>err && 609 test_cmp expect err 610 ' 611 612 test_expect_success 'reflog for symref with unborn target can be listed' ' 613 test_when_finished "rm -rf repo" && 614 git init repo && 615 ( 616 cd repo && 617 test_commit A && 618 git symbolic-ref HEAD refs/heads/unborn && 619 cat >expect <<-EOF && 620 HEAD 621 refs/heads/main 622 EOF 623 git reflog list >actual && 624 test_cmp expect actual 625 ) 626 ' 627 628 test_expect_success 'reflog with invalid object ID can be listed' ' 629 test_when_finished "rm -rf repo" && 630 git init repo && 631 ( 632 cd repo && 633 test_commit A && 634 test-tool ref-store main update-ref msg refs/heads/missing \ 635 $(test_oid deadbeef) "$ZERO_OID" REF_SKIP_OID_VERIFICATION && 636 cat >expect <<-EOF && 637 HEAD 638 refs/heads/main 639 refs/heads/missing 640 EOF 641 git reflog list >actual && 642 test_cmp expect actual 643 ) 644 ' 645 646 test_expect_success 'reflog drop non-existent ref' ' 647 test_when_finished "rm -rf repo" && 648 git init repo && 649 ( 650 cd repo && 651 test_must_fail git reflog exists refs/heads/non-existent && 652 test_must_fail git reflog drop refs/heads/non-existent 2>stderr && 653 test_grep "error: reflog could not be found: ${SQ}refs/heads/non-existent${SQ}" stderr 654 ) 655 ' 656 657 test_expect_success 'reflog drop' ' 658 test_when_finished "rm -rf repo" && 659 git init repo && 660 ( 661 cd repo && 662 test_commit A && 663 test_commit_bulk --ref=refs/heads/branch 1 && 664 git reflog exists refs/heads/main && 665 git reflog exists refs/heads/branch && 666 git reflog drop refs/heads/main && 667 test_must_fail git reflog exists refs/heads/main && 668 git reflog exists refs/heads/branch 669 ) 670 ' 671 672 test_expect_success 'reflog drop multiple references' ' 673 test_when_finished "rm -rf repo" && 674 git init repo && 675 ( 676 cd repo && 677 test_commit A && 678 test_commit_bulk --ref=refs/heads/branch 1 && 679 git reflog exists refs/heads/main && 680 git reflog exists refs/heads/branch && 681 git reflog drop refs/heads/main refs/heads/branch && 682 test_must_fail git reflog exists refs/heads/main && 683 test_must_fail git reflog exists refs/heads/branch 684 ) 685 ' 686 687 test_expect_success 'reflog drop multiple references some non-existent' ' 688 test_when_finished "rm -rf repo" && 689 git init repo && 690 ( 691 cd repo && 692 test_commit A && 693 test_commit_bulk --ref=refs/heads/branch 1 && 694 git reflog exists refs/heads/main && 695 git reflog exists refs/heads/branch && 696 test_must_fail git reflog exists refs/heads/non-existent && 697 test_must_fail git reflog drop refs/heads/main refs/heads/non-existent refs/heads/branch 2>stderr && 698 test_must_fail git reflog exists refs/heads/main && 699 test_must_fail git reflog exists refs/heads/branch && 700 test_must_fail git reflog exists refs/heads/non-existent && 701 test_grep "error: reflog could not be found: ${SQ}refs/heads/non-existent${SQ}" stderr 702 ) 703 ' 704 705 test_expect_success 'reflog drop --all' ' 706 test_when_finished "rm -rf repo" && 707 git init repo && 708 ( 709 cd repo && 710 test_commit A && 711 test_commit_bulk --ref=refs/heads/branch 1 && 712 git reflog exists refs/heads/main && 713 git reflog exists refs/heads/branch && 714 git reflog drop --all && 715 test_must_fail git reflog exists refs/heads/main && 716 test_must_fail git reflog exists refs/heads/branch 717 ) 718 ' 719 720 test_expect_success 'reflog drop --all multiple worktrees' ' 721 test_when_finished "rm -rf repo" && 722 test_when_finished "rm -rf wt" && 723 git init repo && 724 ( 725 cd repo && 726 test_commit A && 727 git worktree add ../wt && 728 test_commit_bulk -C ../wt --ref=refs/heads/branch 1 && 729 git reflog exists refs/heads/main && 730 git reflog exists refs/heads/branch && 731 git reflog drop --all && 732 test_must_fail git reflog exists refs/heads/main && 733 test_must_fail git reflog exists refs/heads/branch 734 ) 735 ' 736 737 test_expect_success 'reflog drop --all --single-worktree' ' 738 test_when_finished "rm -rf repo" && 739 test_when_finished "rm -rf wt" && 740 git init repo && 741 ( 742 cd repo && 743 test_commit A && 744 git worktree add ../wt && 745 test_commit -C ../wt foobar && 746 git reflog exists refs/heads/main && 747 git reflog exists refs/heads/wt && 748 test-tool ref-store worktree:wt reflog-exists HEAD && 749 git reflog drop --all --single-worktree && 750 test_must_fail git reflog exists refs/heads/main && 751 test_must_fail git reflog exists refs/heads/wt && 752 test_must_fail test-tool ref-store worktree:main reflog-exists HEAD && 753 test-tool ref-store worktree:wt reflog-exists HEAD 754 ) 755 ' 756 757 test_expect_success 'reflog drop --all with reference' ' 758 test_when_finished "rm -rf repo" && 759 git init repo && 760 ( 761 cd repo && 762 test_commit A && 763 test_must_fail git reflog drop --all refs/heads/main 2>stderr && 764 test_grep "usage: references specified along with --all" stderr 765 ) 766 ' 767 768 test_expect_success 'expire with pattern config' ' 769 # Split refs/heads/ into two roots so we can apply config to each. Make 770 # two branches per root to verify that config is applied correctly 771 # multiple times. 772 git branch root1/branch1 && 773 git branch root1/branch2 && 774 git branch root2/branch1 && 775 git branch root2/branch2 && 776 777 test_config "gc.reflogexpire" "never" && 778 test_config "gc.refs/heads/root2/*.reflogExpire" "now" && 779 git reflog expire \ 780 root1/branch1 root1/branch2 \ 781 root2/branch1 root2/branch2 && 782 783 cat >expect <<-\EOF && 784 root1/branch1@{0} 785 root1/branch2@{0} 786 EOF 787 git log -g --branches="root*" --format=%gD >actual.raw && 788 # The sole reflog entry of each branch points to the same commit, so 789 # the order in which they are shown is nondeterministic. We just care 790 # about the what was expired (and what was not), so sort to get a known 791 # order. 792 sort actual.sorted && 793 test_cmp expect actual.sorted 794 ' 795 796 test_done