diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-13 22:37:24 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-13 22:37:24 +0900 |
commit | 6e31fa9cc263ee6a65123fbe47dfc87592adcfb0 (patch) | |
tree | 35c6fc8d990203affb989e9408fdce99f75de943 | |
parent | Merge branch 'pw/am-rebase-read-author-script' (diff) | |
parent | tests: optionally skip `git rebase -p` tests (diff) | |
download | tgif-6e31fa9cc263ee6a65123fbe47dfc87592adcfb0.tar.xz |
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
-rwxr-xr-x | t/t3404-rebase-interactive.sh | 23 | ||||
-rwxr-xr-x | t/t3408-rebase-multi-line.sh | 2 | ||||
-rwxr-xr-x | t/t3409-rebase-preserve-merges.sh | 5 | ||||
-rwxr-xr-x | t/t3410-rebase-preserve-dropped-merges.sh | 5 | ||||
-rwxr-xr-x | t/t3411-rebase-preserve-around-merges.sh | 5 | ||||
-rwxr-xr-x | t/t3412-rebase-root.sh | 12 | ||||
-rwxr-xr-x | t/t3414-rebase-preserve-onto.sh | 5 | ||||
-rwxr-xr-x | t/t3418-rebase-continue.sh | 5 | ||||
-rwxr-xr-x | t/t3421-rebase-topology-linear.sh | 36 | ||||
-rwxr-xr-x | t/t3425-rebase-topology-merges.sh | 5 | ||||
-rwxr-xr-x | t/t5520-pull.sh | 6 | ||||
-rwxr-xr-x | t/t7505-prepare-commit-msg-hook.sh | 2 | ||||
-rwxr-xr-x | t/t7517-per-repo-email.sh | 6 | ||||
-rw-r--r-- | t/test-lib.sh | 4 |
14 files changed, 78 insertions, 43 deletions
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index f6737e162f..7a440e08d8 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -322,7 +322,7 @@ test_expect_success 'retain authorship when squashing' ' 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 +332,7 @@ test_expect_success '-p handles "no changes" gracefully' ' 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 +340,7 @@ test_expect_failure 'exchange two commits with -p' ' 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 +383,7 @@ test_expect_success 'preserve merges with -p' ' 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 +397,7 @@ test_expect_success 'edit ancestor with -p' ' ' 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 +437,7 @@ test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' ' 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 +452,7 @@ test_expect_success 'commit message used after conflict' ' 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 +467,7 @@ test_expect_success 'commit message retained after conflict' ' 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 +492,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messa 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 +505,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' ' 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 +518,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' ' 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 ' @@ -658,7 +659,7 @@ test_expect_success 'rebase with a file named HEAD in worktree' ' ) && 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" ' diff --git a/t/t3408-rebase-multi-line.sh b/t/t3408-rebase-multi-line.sh index e7292f5b9b..d2bd7c17b0 100755 --- a/t/t3408-rebase-multi-line.sh +++ b/t/t3408-rebase-multi-line.sh @@ -52,7 +52,7 @@ test_expect_success rebase ' test_cmp expect actual ' -test_expect_success rebasep ' +test_expect_success REBASE_P rebasep ' git checkout side-merge && git rebase -p side && diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh index 8c251c57a6..3b340f1ece 100755 --- a/t/t3409-rebase-preserve-merges.sh +++ b/t/t3409-rebase-preserve-merges.sh @@ -8,6 +8,11 @@ Run "git rebase -p" and check that merges are properly carried along ' . ./test-lib.sh +if ! test_have_prereq REBASE_P; then + skip_all='skipping git rebase -p tests, as asked for' + test_done +fi + GIT_AUTHOR_EMAIL=bogus_email_address export GIT_AUTHOR_EMAIL diff --git a/t/t3410-rebase-preserve-dropped-merges.sh b/t/t3410-rebase-preserve-dropped-merges.sh index 6f73b95558..2e29866993 100755 --- a/t/t3410-rebase-preserve-dropped-merges.sh +++ b/t/t3410-rebase-preserve-dropped-merges.sh @@ -11,6 +11,11 @@ rewritten. ' . ./test-lib.sh +if ! test_have_prereq REBASE_P; then + skip_all='skipping git rebase -p tests, as asked for' + test_done +fi + # set up two branches like this: # # A - B - C - D - E diff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh index dc81bf27eb..fb45e7bf7b 100755 --- a/t/t3411-rebase-preserve-around-merges.sh +++ b/t/t3411-rebase-preserve-around-merges.sh @@ -10,6 +10,11 @@ a merge to before the merge. ' . ./test-lib.sh +if ! test_have_prereq REBASE_P; then + skip_all='skipping git rebase -p tests, as asked for' + test_done +fi + . "$TEST_DIRECTORY"/lib-rebase.sh set_fake_editor diff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh index 73a39f2923..21632a984e 100755 --- a/t/t3412-rebase-root.sh +++ b/t/t3412-rebase-root.sh @@ -86,14 +86,14 @@ test_expect_success 'pre-rebase got correct input (4)' ' test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,work4 ' -test_expect_success 'rebase -i -p with linear history' ' +test_expect_success REBASE_P 'rebase -i -p with linear history' ' git checkout -b work5 other && git rebase -i -p --root --onto master && git log --pretty=tformat:"%s" > rebased5 && test_cmp expect rebased5 ' -test_expect_success 'pre-rebase got correct input (5)' ' +test_expect_success REBASE_P 'pre-rebase got correct input (5)' ' test "z$(cat .git/PRE-REBASE-INPUT)" = z--root, ' @@ -120,7 +120,7 @@ commit work6~4 1 EOF -test_expect_success 'rebase -i -p with merge' ' +test_expect_success REBASE_P 'rebase -i -p with merge' ' git checkout -b work6 other && git rebase -i -p --root --onto master && log_with_names work6 > rebased6 && @@ -155,7 +155,7 @@ commit work7~5 1 EOF -test_expect_success 'rebase -i -p with two roots' ' +test_expect_success REBASE_P 'rebase -i -p with two roots' ' git checkout -b work7 other && git rebase -i -p --root --onto master && log_with_names work7 > rebased7 && @@ -261,7 +261,7 @@ commit conflict3~6 1 EOF -test_expect_success 'rebase -i -p --root with conflict (first part)' ' +test_expect_success REBASE_P 'rebase -i -p --root with conflict (first part)' ' git checkout -b conflict3 other && test_must_fail git rebase -i -p --root --onto master && git ls-files -u | grep "B$" @@ -272,7 +272,7 @@ test_expect_success 'fix the conflict' ' git add B ' -test_expect_success 'rebase -i -p --root with conflict (second part)' ' +test_expect_success REBASE_P 'rebase -i -p --root with conflict (second part)' ' git rebase --continue && log_with_names conflict3 >out && test_cmp expect-conflict-p out diff --git a/t/t3414-rebase-preserve-onto.sh b/t/t3414-rebase-preserve-onto.sh index ee0a6cccfd..72e04b5386 100755 --- a/t/t3414-rebase-preserve-onto.sh +++ b/t/t3414-rebase-preserve-onto.sh @@ -10,6 +10,11 @@ aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM. ' . ./test-lib.sh +if ! test_have_prereq REBASE_P; then + skip_all='skipping git rebase -p tests, as asked for' + test_done +fi + . "$TEST_DIRECTORY"/lib-rebase.sh # Set up branches like this: diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh index 4c3f7d8dfe..0210b2ac6f 100755 --- a/t/t3418-rebase-continue.sh +++ b/t/t3418-rebase-continue.sh @@ -106,7 +106,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' ' 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 @@ test_expect_success 'setup rerere database' ' 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,7 +241,7 @@ test_rerere_autoupdate 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' ' diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh index 99b2aac921..23ad4cff35 100755 --- a/t/t3421-rebase-topology-linear.sh +++ b/t/t3421-rebase-topology-linear.sh @@ -29,7 +29,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -43,7 +43,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -59,7 +59,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 @@ -73,7 +73,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p # f # / @@ -113,7 +113,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase failure -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -128,7 +128,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase failure -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -143,7 +143,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase failure -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -158,7 +158,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p # a---b---c---j! # \ @@ -186,7 +186,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -201,7 +201,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 @@ -216,7 +216,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase success --rebase-merges # m @@ -256,7 +256,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -271,7 +271,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 @@ -286,7 +286,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase failure -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -302,7 +302,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 @@ -317,7 +317,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase failure -m test_run_rebase success -i -test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 @@ -331,7 +331,7 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 @@ -346,6 +346,6 @@ test_run_rebase () { test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_done diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh index 846f85c27e..5f892e33d7 100755 --- a/t/t3425-rebase-topology-merges.sh +++ b/t/t3425-rebase-topology-merges.sh @@ -109,6 +109,11 @@ test_run_rebase success 'd e n o' '' test_run_rebase success 'd e n o' -m test_run_rebase success 'd n o e' -i +if ! test_have_prereq REBASE_P; then + skip_all='skipping git rebase -p tests, as asked for' + test_done +fi + test_expect_success "rebase -p is no-op in non-linear history" " reset_rebase && git rebase -p d w && diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 5e501c8b08..cf4cc32fd0 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -461,7 +461,8 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' ' test file3 = "$(git show HEAD:file3.t)" ' -test_expect_success 'pull.rebase=preserve rebases and merges keep-merge' ' +test_expect_success REBASE_P \ + 'pull.rebase=preserve rebases and merges keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase preserve && git pull . copy && @@ -514,7 +515,8 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' ' test file3 = "$(git show HEAD:file3.t)" ' -test_expect_success '--rebase=preserve rebases and merges keep-merge' ' +test_expect_success REBASE_P \ + '--rebase=preserve rebases and merges keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase true && git pull --rebase=preserve . copy && diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh index 1f43b3cd4c..ebfcad9c4c 100755 --- a/t/t7505-prepare-commit-msg-hook.sh +++ b/t/t7505-prepare-commit-msg-hook.sh @@ -253,7 +253,7 @@ test_rebase () { } test_rebase success -i -test_rebase success -p +test_have_prereq !REBASE_P || test_rebase success -p test_expect_success 'with hook (cherry-pick)' ' test_when_finished "git checkout -f master" && diff --git a/t/t7517-per-repo-email.sh b/t/t7517-per-repo-email.sh index 2a22fa7588..231b8cc19d 100755 --- a/t/t7517-per-repo-email.sh +++ b/t/t7517-per-repo-email.sh @@ -72,12 +72,14 @@ test_expect_success 'noop interactive rebase does not care about ident' ' git rebase -i HEAD^ ' -test_expect_success 'fast-forward rebase does not care about ident (preserve)' ' +test_expect_success REBASE_P \ + 'fast-forward rebase does not care about ident (preserve)' ' git checkout -B tmp side-without-commit && git rebase -p master ' -test_expect_success 'non-fast-forward rebase refuses to write commits (preserve)' ' +test_expect_success REBASE_P \ + 'non-fast-forward rebase refuses to write commits (preserve)' ' test_when_finished "git rebase --abort || true" && git checkout -B tmp side-with-commit && test_must_fail git rebase -p master diff --git a/t/test-lib.sh b/t/test-lib.sh index 47a99aa0ed..aba66cafa2 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1268,3 +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" +' |