Git fork

Merge branch 'ua/t3404-cleanup'

Test update.

* ua/t3404-cleanup:
t3404: replace test with test_line_count()
t3404: avoid losing exit status with focus on `git show` and `git cat-file`

+50 -25
+50 -25
t/t3404-rebase-interactive.sh
··· 281 test_cmp expect2 file1 && 282 test "$(git diff --name-status | 283 sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 && 284 - test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) && 285 - test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo) 286 ' 287 288 test_expect_success 'show conflicted patch' ' ··· 319 GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" && 320 git tag twerp && 321 git rebase -i --onto primary HEAD^ && 322 - git show HEAD | grep "^Author: Twerp Snog" 323 ' 324 325 test_expect_success 'retain authorship w/ conflicts' ' ··· 360 ' 361 362 test_expect_success 'retain authorship when squashing' ' 363 - git show HEAD | grep "^Author: Twerp Snog" 364 ' 365 366 test_expect_success '--continue tries to commit' ' ··· 374 FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue 375 ) && 376 test_cmp_rev HEAD^ new-branch1 && 377 - git show HEAD | grep chouette 378 ' 379 380 test_expect_success 'verbose flag is heeded, even after --continue' ' ··· 397 git rebase -i $base 398 ) && 399 test $base = $(git rev-parse HEAD^) && 400 - test 1 = $(git show | grep ONCE | wc -l) 401 ' 402 403 test_expect_success 'multi-fixup does not fire up editor' ' ··· 410 git rebase -i $base 411 ) && 412 test $base = $(git rev-parse HEAD^) && 413 - test 0 = $(git show | grep NEVER | wc -l) && 414 git checkout @{-1} && 415 git branch -D multi-fixup 416 ' ··· 428 git rebase --continue 429 ) && 430 test $base = $(git rev-parse HEAD^) && 431 - test 1 = $(git show | grep ONCE | wc -l) && 432 git checkout @{-1} && 433 git branch -D conflict-fixup 434 ' ··· 446 git rebase --continue 447 ) && 448 test $base = $(git rev-parse HEAD^) && 449 - test 2 = $(git show | grep TWICE | wc -l) && 450 git checkout @{-1} && 451 git branch -D conflict-squash 452 ' ··· 470 ) && 471 git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup && 472 test_cmp expect-squash-fixup actual-squash-fixup && 473 - git cat-file commit HEAD@{2} | 474 - grep "^# This is a combination of 3 commits\." && 475 - git cat-file commit HEAD@{3} | 476 - grep "^# This is a combination of 2 commits\." && 477 git checkout @{-1} && 478 git branch -D squash-fixup 479 ' ··· 489 git rebase -i $base 490 ) && 491 test $base = $(git rev-parse HEAD^) && 492 - test 1 = $(git show | grep ONCE | wc -l) && 493 git checkout @{-1} && 494 git branch -D skip-comments 495 ' ··· 505 git rebase -i $base 506 ) && 507 test $base = $(git rev-parse HEAD^) && 508 - test 1 = $(git show | grep ONCE | wc -l) && 509 git checkout @{-1} && 510 git branch -D skip-blank-lines 511 ' ··· 572 FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue 573 ) && 574 test edited = $(git show HEAD:file7) && 575 - git show HEAD | grep chouette && 576 test $parent = $(git rev-parse HEAD^) 577 ' 578 ··· 757 set_fake_editor && 758 FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" \ 759 git rebase -i A && 760 - git show HEAD | grep "E changed" && 761 test $(git rev-parse primary) != $(git rev-parse HEAD) && 762 test_cmp_rev primary^ HEAD^ && 763 FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" \ 764 git rebase -i A && 765 - git show HEAD^ | grep "D changed" && 766 FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" \ 767 git rebase -i A && 768 - git show HEAD~3 | grep "B changed" && 769 FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" \ 770 git rebase -i A 771 ) && 772 - git show HEAD~2 | grep "C changed" 773 ' 774 775 test_expect_success 'no uncommitted changes when rewording and the todo list is reloaded' ' ··· 1003 set_fake_editor && 1004 FAKE_LINES="2" git rebase -i --root 1005 ) && 1006 - git cat-file commit HEAD | grep -q "^author Twerp Snog" && 1007 - git cat-file commit HEAD | grep -q "^different author$" 1008 ' 1009 1010 test_expect_success 'rebase -i --root temporary sentinel commit' ' ··· 1013 set_fake_editor && 1014 test_must_fail env FAKE_LINES="2" git rebase -i --root 1015 ) && 1016 - git cat-file commit HEAD | grep "^tree $EMPTY_TREE" && 1017 git rebase --abort 1018 ' 1019 ··· 1036 FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \ 1037 git rebase -i --root 1038 ) && 1039 - git show HEAD^ | grep "A changed" && 1040 test -z "$(git show -s --format=%p HEAD^)" 1041 ' 1042 ··· 1048 FAKE_LINES="reword 3 1" FAKE_COMMIT_MESSAGE="C changed" \ 1049 git rebase -i --root 1050 ) && 1051 - git show HEAD^ | grep "C changed" && 1052 test -z "$(git show -s --format=%p HEAD^)" 1053 ' 1054
··· 281 test_cmp expect2 file1 && 282 test "$(git diff --name-status | 283 sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 && 284 + grep -v "^#" <.git/rebase-merge/done >actual && 285 + test_line_count = 4 actual && 286 + test 0 = $(grep -c "^[^#]" <.git/rebase-merge/git-rebase-todo) 287 ' 288 289 test_expect_success 'show conflicted patch' ' ··· 320 GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" && 321 git tag twerp && 322 git rebase -i --onto primary HEAD^ && 323 + git show HEAD >actual && 324 + grep "^Author: Twerp Snog" actual 325 ' 326 327 test_expect_success 'retain authorship w/ conflicts' ' ··· 362 ' 363 364 test_expect_success 'retain authorship when squashing' ' 365 + git show HEAD >actual && 366 + grep "^Author: Twerp Snog" actual 367 ' 368 369 test_expect_success '--continue tries to commit' ' ··· 377 FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue 378 ) && 379 test_cmp_rev HEAD^ new-branch1 && 380 + git show HEAD >actual && 381 + grep chouette actual 382 ' 383 384 test_expect_success 'verbose flag is heeded, even after --continue' ' ··· 401 git rebase -i $base 402 ) && 403 test $base = $(git rev-parse HEAD^) && 404 + git show >output && 405 + grep ONCE output >actual && 406 + test_line_count = 1 actual 407 ' 408 409 test_expect_success 'multi-fixup does not fire up editor' ' ··· 416 git rebase -i $base 417 ) && 418 test $base = $(git rev-parse HEAD^) && 419 + git show >output && 420 + ! grep NEVER output && 421 git checkout @{-1} && 422 git branch -D multi-fixup 423 ' ··· 435 git rebase --continue 436 ) && 437 test $base = $(git rev-parse HEAD^) && 438 + git show >output && 439 + grep ONCE output >actual && 440 + test_line_count = 1 actual && 441 git checkout @{-1} && 442 git branch -D conflict-fixup 443 ' ··· 455 git rebase --continue 456 ) && 457 test $base = $(git rev-parse HEAD^) && 458 + git show >output && 459 + grep TWICE output >actual && 460 + test_line_count = 2 actual && 461 git checkout @{-1} && 462 git branch -D conflict-squash 463 ' ··· 481 ) && 482 git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup && 483 test_cmp expect-squash-fixup actual-squash-fixup && 484 + git cat-file commit HEAD@{2} >actual && 485 + grep "^# This is a combination of 3 commits\." actual && 486 + git cat-file commit HEAD@{3} >actual && 487 + grep "^# This is a combination of 2 commits\." actual && 488 git checkout @{-1} && 489 git branch -D squash-fixup 490 ' ··· 500 git rebase -i $base 501 ) && 502 test $base = $(git rev-parse HEAD^) && 503 + git show >output && 504 + grep ONCE output >actual && 505 + test_line_count = 1 actual && 506 git checkout @{-1} && 507 git branch -D skip-comments 508 ' ··· 518 git rebase -i $base 519 ) && 520 test $base = $(git rev-parse HEAD^) && 521 + git show >output && 522 + grep ONCE output >actual && 523 + test_line_count = 1 actual && 524 git checkout @{-1} && 525 git branch -D skip-blank-lines 526 ' ··· 587 FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue 588 ) && 589 test edited = $(git show HEAD:file7) && 590 + git show HEAD >actual && 591 + grep chouette actual && 592 test $parent = $(git rev-parse HEAD^) 593 ' 594 ··· 773 set_fake_editor && 774 FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" \ 775 git rebase -i A && 776 + git show HEAD >actual && 777 + grep "E changed" actual && 778 test $(git rev-parse primary) != $(git rev-parse HEAD) && 779 test_cmp_rev primary^ HEAD^ && 780 FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" \ 781 git rebase -i A && 782 + git show HEAD^ >actual && 783 + grep "D changed" actual && 784 FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" \ 785 git rebase -i A && 786 + git show HEAD~3 >actual && 787 + grep "B changed" actual && 788 FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" \ 789 git rebase -i A 790 ) && 791 + git show HEAD~2 >actual && 792 + grep "C changed" actual 793 ' 794 795 test_expect_success 'no uncommitted changes when rewording and the todo list is reloaded' ' ··· 1023 set_fake_editor && 1024 FAKE_LINES="2" git rebase -i --root 1025 ) && 1026 + git cat-file commit HEAD >output && 1027 + grep -q "^author Twerp Snog" output && 1028 + git cat-file commit HEAD >actual && 1029 + grep -q "^different author$" actual 1030 ' 1031 1032 test_expect_success 'rebase -i --root temporary sentinel commit' ' ··· 1035 set_fake_editor && 1036 test_must_fail env FAKE_LINES="2" git rebase -i --root 1037 ) && 1038 + git cat-file commit HEAD >actual && 1039 + grep "^tree $EMPTY_TREE" actual && 1040 git rebase --abort 1041 ' 1042 ··· 1059 FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \ 1060 git rebase -i --root 1061 ) && 1062 + git show HEAD^ >actual && 1063 + grep "A changed" actual && 1064 test -z "$(git show -s --format=%p HEAD^)" 1065 ' 1066 ··· 1072 FAKE_LINES="reword 3 1" FAKE_COMMIT_MESSAGE="C changed" \ 1073 git rebase -i --root 1074 ) && 1075 + git show HEAD^ >actual && 1076 + grep "C changed" actual && 1077 test -z "$(git show -s --format=%p HEAD^)" 1078 ' 1079