diff options
Diffstat (limited to 't/t3418-rebase-continue.sh')
-rwxr-xr-x | t/t3418-rebase-continue.sh | 83 |
1 files changed, 71 insertions, 12 deletions
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh index 0210b2ac6f..f4c2ee02bc 100755 --- a/t/t3418-rebase-continue.sh +++ b/t/t3418-rebase-continue.sh @@ -2,6 +2,9 @@ test_description='git rebase --continue tests' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh @@ -15,13 +18,13 @@ test_expect_success 'setup' ' git checkout -b topic HEAD^ && test_commit "commit-new-file-F2-on-topic-branch" F2 22 && - git checkout master + git checkout main ' test_expect_success 'interactive rebase --continue works with touched file' ' rm -fr .git/rebase-* && git reset --hard && - git checkout master && + git checkout main && FAKE_LINES="edit 1" git rebase -i HEAD^ && test-tool chmtime =-60 F1 && @@ -31,9 +34,9 @@ test_expect_success 'interactive rebase --continue works with touched file' ' test_expect_success 'non-interactive rebase --continue works with touched file' ' rm -fr .git/rebase-* && git reset --hard && - git checkout master && + git checkout main && - test_must_fail git rebase --onto master master topic && + test_must_fail git rebase --onto main main topic && echo "Resolved" >F2 && git add F2 && test-tool chmtime =-60 F1 && @@ -61,7 +64,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' ' chmod +x test-bin/git-merge-funny && ( PATH=./test-bin:$PATH && - test_must_fail git rebase -s funny -Xopt master topic + test_must_fail git rebase -s funny -Xopt main topic ) && test -f funny.was.run && rm funny.was.run && @@ -93,7 +96,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' ' chmod +x test-bin/git-merge-funny && ( PATH=./test-bin:$PATH && - test_must_fail git rebase -i -s funny -Xopt -Xfoo master topic + test_must_fail git rebase -i -s funny -Xopt -Xfoo main topic ) && test -f funny.was.run && rm funny.was.run && @@ -120,6 +123,20 @@ test_expect_success REBASE_P 'rebase passes merge strategy options correctly' ' git rebase --continue ' +test_expect_success 'rebase -r passes merge strategy options correctly' ' + rm -fr .git/rebase-* && + git reset --hard commit-new-file-F3-on-topic-branch && + test_commit merge-theirs && + git reset --hard HEAD^ && + test_commit some-other-commit && + test_tick && + git merge --no-ff merge-theirs && + FAKE_LINES="1 3 edit 4 5 7 8 9" git rebase -i -f -r -m \ + -s recursive --strategy-option=theirs HEAD~2 && + test_commit force-change-ours && + git rebase --continue +' + test_expect_success '--skip after failed fixup cleans commit message' ' test_when_finished "test_might_fail git rebase --abort" && git checkout -b with-conflicting-fixup && @@ -174,11 +191,11 @@ test_expect_success '--skip after failed fixup cleans commit message' ' test_expect_success 'setup rerere database' ' rm -fr .git/rebase-* && git reset --hard commit-new-file-F3-on-topic-branch && - git checkout master && + git checkout main && 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 && + test_must_fail git rebase -m main topic && echo "Resolved" >F2 && cp F2 expected-F2 && git add F2 && @@ -193,7 +210,7 @@ test_expect_success 'setup rerere database' ' prepare () { rm -fr .git/rebase-* && git reset --hard commit-new-file-F3-on-topic-branch && - git checkout master && + git checkout main && test_config rerere.enabled true } @@ -201,7 +218,7 @@ test_rerere_autoupdate () { action=$1 && test_expect_success "rebase $action --continue remembers --rerere-autoupdate" ' prepare && - test_must_fail git rebase $action --rerere-autoupdate master topic && + test_must_fail git rebase $action --rerere-autoupdate main topic && test_cmp expected-F2 F2 && git diff-files --quiet && test_must_fail git rebase --continue && @@ -213,7 +230,7 @@ test_rerere_autoupdate () { test_expect_success "rebase $action --continue honors rerere.autoUpdate" ' prepare && test_config rerere.autoupdate true && - test_must_fail git rebase $action master topic && + test_must_fail git rebase $action main topic && test_cmp expected-F2 F2 && git diff-files --quiet && test_must_fail git rebase --continue && @@ -225,7 +242,7 @@ test_rerere_autoupdate () { test_expect_success "rebase $action --continue remembers --no-rerere-autoupdate" ' prepare && test_config rerere.autoupdate true && - test_must_fail git rebase $action --no-rerere-autoupdate master topic && + test_must_fail git rebase $action --no-rerere-autoupdate main topic && test_cmp expected-F2 F2 && test_must_fail git diff-files --quiet && git add F2 && @@ -254,4 +271,46 @@ test_expect_success 'the todo command "break" works' ' test_path_is_file execed ' +test_expect_success '--reschedule-failed-exec' ' + test_when_finished "git rebase --abort" && + test_must_fail git rebase -x false --reschedule-failed-exec HEAD^ && + grep "^exec false" .git/rebase-merge/git-rebase-todo && + git rebase --abort && + test_must_fail git -c rebase.rescheduleFailedExec=true \ + rebase -x false HEAD^ 2>err && + grep "^exec false" .git/rebase-merge/git-rebase-todo && + test_i18ngrep "has been rescheduled" err +' + +test_expect_success 'rebase.rescheduleFailedExec only affects `rebase -i`' ' + test_config rebase.rescheduleFailedExec true && + test_must_fail git rebase -x false HEAD^ && + grep "^exec false" .git/rebase-merge/git-rebase-todo && + git rebase --abort && + git rebase HEAD^ +' + +test_expect_success 'rebase.rescheduleFailedExec=true & --no-reschedule-failed-exec' ' + test_when_finished "git rebase --abort" && + test_config rebase.rescheduleFailedExec true && + test_must_fail git rebase -x false --no-reschedule-failed-exec HEAD~2 && + test_must_fail git rebase --continue 2>err && + ! grep "has been rescheduled" err +' + +test_expect_success 'new rebase.rescheduleFailedExec=true setting in an ongoing rebase is ignored' ' + test_when_finished "git rebase --abort" && + test_must_fail git rebase -x false HEAD~2 && + test_config rebase.rescheduleFailedExec true && + test_must_fail git rebase --continue 2>err && + ! grep "has been rescheduled" err +' + +test_expect_success 'there is no --no-reschedule-failed-exec in an ongoing rebase' ' + test_when_finished "git rebase --abort" && + test_must_fail git rebase -x false HEAD~2 && + test_expect_code 129 git rebase --continue --no-reschedule-failed-exec && + test_expect_code 129 git rebase --edit-todo --no-reschedule-failed-exec +' + test_done |