From: Junio C Hamano Date: Tue, 13 Nov 2018 13:37:24 +0000 (+0900) Subject: Merge branch 'js/rebase-p-tests' X-Git-Tag: v2.20.0-rc0~41 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6e31fa9cc263ee6a65123fbe47dfc87592adcfb0?ds=inline;hp=-c Merge branch 'js/rebase-p-tests' In preparation to the day when we can deprecate and remove the "rebase -p", make sure we can skip and later remove tests for it. * js/rebase-p-tests: tests: optionally skip `git rebase -p` tests t3418: decouple test cases from a previous `rebase -p` test case t3404: decouple some test cases from outcomes of previous test cases --- 6e31fa9cc263ee6a65123fbe47dfc87592adcfb0 diff --combined t/t3404-rebase-interactive.sh index f6737e162f,68ca8dc9bb..7a440e08d8 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@@ -75,16 -75,6 +75,16 @@@ test_expect_success 'rebase --keep-empt test_line_count = 6 actual ' +cat > expect <actual 2>&1 && + test_i18ncmp expect actual +' + test_expect_success 'rebase -i with the exec command' ' git checkout master && ( @@@ -124,7 -114,7 +124,7 @@@ test_expect_success 'rebase -i with exe git checkout master && mkdir subdir && (cd subdir && set_fake_editor && - FAKE_LINES="1 exec_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \ + FAKE_LINES="1 x_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \ git rebase -i HEAD^ ) ' @@@ -322,7 -312,7 +322,7 @@@ test_expect_success 'retain authorship git show HEAD | grep "^Author: Twerp Snog" ' - test_expect_success '-p handles "no changes" gracefully' ' + test_expect_success REBASE_P '-p handles "no changes" gracefully' ' HEAD=$(git rev-parse HEAD) && set_fake_editor && git rebase -i -p HEAD^ && @@@ -332,7 -322,7 +332,7 @@@ test $HEAD = $(git rev-parse HEAD) ' - test_expect_failure 'exchange two commits with -p' ' + test_expect_failure REBASE_P 'exchange two commits with -p' ' git checkout H && set_fake_editor && FAKE_LINES="2 1" git rebase -i -p HEAD~2 && @@@ -340,7 -330,7 +340,7 @@@ test G = $(git cat-file commit HEAD | sed -ne \$p) ' - test_expect_success 'preserve merges with -p' ' + test_expect_success REBASE_P 'preserve merges with -p' ' git checkout -b to-be-preserved master^ && : > unrelated-file && git add unrelated-file && @@@ -383,7 -373,7 +383,7 @@@ test $(git show HEAD:unrelated-file) = 1 ' - test_expect_success 'edit ancestor with -p' ' + test_expect_success REBASE_P 'edit ancestor with -p' ' set_fake_editor && FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 && echo 2 > unrelated-file && @@@ -397,6 -387,7 +397,7 @@@ ' test_expect_success '--continue tries to commit' ' + git reset --hard D && test_tick && set_fake_editor && test_must_fail git rebase -i --onto new-branch1 HEAD^ && @@@ -436,7 -427,7 +437,7 @@@ test_expect_success C_LOCALE_OUTPUT 'mu git rebase -i $base && test $base = $(git rev-parse HEAD^) && test 0 = $(git show | grep NEVER | wc -l) && - git checkout to-be-rebased && + git checkout @{-1} && git branch -D multi-fixup ' @@@ -451,7 -442,7 +452,7 @@@ test_expect_success 'commit message use git rebase --continue && test $base = $(git rev-parse HEAD^) && test 1 = $(git show | grep ONCE | wc -l) && - git checkout to-be-rebased && + git checkout @{-1} && git branch -D conflict-fixup ' @@@ -466,7 -457,7 +467,7 @@@ test_expect_success 'commit message ret git rebase --continue && test $base = $(git rev-parse HEAD^) && test 2 = $(git show | grep TWICE | wc -l) && - git checkout to-be-rebased && + git checkout @{-1} && git branch -D conflict-squash ' @@@ -491,7 -482,7 +492,7 @@@ test_expect_success C_LOCALE_OUTPUT 'sq grep "^# This is a combination of 3 commits\." && git cat-file commit HEAD@{3} | grep "^# This is a combination of 2 commits\." && - git checkout to-be-rebased && + git checkout @{-1} && git branch -D squash-fixup ' @@@ -504,7 -495,7 +505,7 @@@ test_expect_success C_LOCALE_OUTPUT 'sq git rebase -i $base && test $base = $(git rev-parse HEAD^) && test 1 = $(git show | grep ONCE | wc -l) && - git checkout to-be-rebased && + git checkout @{-1} && git branch -D skip-comments ' @@@ -517,7 -508,7 +518,7 @@@ test_expect_success C_LOCALE_OUTPUT 'sq git rebase -i $base && test $base = $(git rev-parse HEAD^) && test 1 = $(git show | grep ONCE | wc -l) && - git checkout to-be-rebased && + git checkout @{-1} && git branch -D skip-blank-lines ' @@@ -525,7 -516,7 +526,7 @@@ test_expect_success 'squash works as ex git checkout -b squash-works no-conflict-branch && one=$(git rev-parse HEAD~3) && set_fake_editor && - FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \ + FAKE_LINES="1 s 3 2" EXPECT_HEADER_COUNT=2 \ git rebase -i HEAD~3 && test $one = $(git rev-parse HEAD~2) ' @@@ -658,7 -649,7 +659,7 @@@ test_expect_success 'rebase with a fil ) && set_fake_editor && - FAKE_LINES="1 squash 2" git rebase -i to-be-rebased && + FAKE_LINES="1 squash 2" git rebase -i @{-1} && test "$(git show -s --pretty=format:%an)" = "Squashed Away" ' @@@ -758,7 -749,7 +759,7 @@@ test_expect_success 'reword' git show HEAD^ | grep "D changed" && FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" git rebase -i A && git show HEAD~3 | grep "B changed" && - FAKE_LINES="1 reword 2 3 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A && + FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A && git show HEAD~2 | grep "C changed" ' @@@ -784,7 -775,7 +785,7 @@@ test_expect_success 'rebase -i can cop git reset --hard n3 && git notes add -m"an earlier note" n2 && set_fake_editor && - GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 && + GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 f 2" git rebase -i n1 && git notes show > output && test_cmp expect output ' @@@ -1261,7 -1252,7 +1262,7 @@@ rebase_setup_and_clean () test_expect_success 'drop' ' rebase_setup_and_clean drop-test && set_fake_editor && - FAKE_LINES="1 drop 2 3 drop 4 5" git rebase -i --root && + FAKE_LINES="1 drop 2 3 d 4 5" git rebase -i --root && test E = $(git cat-file commit HEAD | sed -ne \$p) && test C = $(git cat-file commit HEAD^ | sed -ne \$p) && test A = $(git cat-file commit HEAD^^ | sed -ne \$p) diff --combined t/t3418-rebase-continue.sh index 4c3f7d8dfe,f0025c7810..0210b2ac6f --- a/t/t3418-rebase-continue.sh +++ b/t/t3418-rebase-continue.sh @@@ -106,7 -106,7 +106,7 @@@ test_expect_success 'rebase -i --contin test -f funny.was.run ' - test_expect_success 'rebase passes merge strategy options correctly' ' + test_expect_success REBASE_P 'rebase passes merge strategy options correctly' ' rm -fr .git/rebase-* && git reset --hard commit-new-file-F3-on-topic-branch && test_commit theirs-to-merge && @@@ -177,6 -177,7 +177,7 @@@ test_expect_success 'setup rerere datab git checkout master && test_commit "commit-new-file-F3" F3 3 && test_config rerere.enabled true && + git update-ref refs/heads/topic commit-new-file-F3-on-topic-branch && test_must_fail git rebase -m master topic && echo "Resolved" >F2 && cp F2 expected-F2 && @@@ -240,17 -241,6 +241,17 @@@ test_rerere_autoupdat test_rerere_autoupdate -m GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR test_rerere_autoupdate -i - test_rerere_autoupdate --preserve-merges + test_have_prereq !REBASE_P || test_rerere_autoupdate --preserve-merges +unset GIT_SEQUENCE_EDITOR + +test_expect_success 'the todo command "break" works' ' + rm -f execed && + FAKE_LINES="break b exec_>execed" git rebase -i HEAD && + test_path_is_missing execed && + git rebase --continue && + test_path_is_missing execed && + git rebase --continue && + test_path_is_file execed +' test_done diff --combined t/test-lib.sh index 47a99aa0ed,8b3d0ca7d1..aba66cafa2 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -67,7 -67,7 +67,7 @@@ case "$GIT_TEST_TEE_STARTED, $* " i done,*) # do not redirect again ;; -*' --tee '*|*' --va'*|*' --verbose-log '*) +*' --tee '*|*' --va'*|*' -V '*|*' --verbose-log '*) mkdir -p "$TEST_OUTPUT_DIRECTORY/test-results" BASE="$TEST_OUTPUT_DIRECTORY/test-results/$(basename "$0" .sh)" @@@ -316,7 -316,7 +316,7 @@@ d echo >&2 "warning: ignoring -x; '$0' is untraceable without BASH_XTRACEFD" fi shift ;; - --verbose-log) + -V|--verbose-log) verbose_log=t shift ;; *) @@@ -1268,3 -1268,7 +1268,7 @@@ test_lazy_prereq CURL test_lazy_prereq SHA1 ' test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ' + + test_lazy_prereq REBASE_P ' + test -z "$GIT_TEST_SKIP_REBASE_P" + '