diff options
Diffstat (limited to 't/t3406-rebase-message.sh')
-rwxr-xr-x | t/t3406-rebase-message.sh | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index b393e1e9fe..77a313f62e 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -2,6 +2,9 @@ test_description='messages from rebase operation' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh test_expect_success 'setup' ' @@ -18,62 +21,52 @@ test_expect_success 'setup' ' ' test_expect_success 'rebase -m' ' - git rebase -m master >report && - >expect && - sed -n -e "/^Already applied: /p" \ - -e "/^Committed: /p" report >actual && - test_cmp expect actual + git rebase -m main >actual && + test_must_be_empty actual ' -test_expect_success 'rebase against master twice' ' - git rebase master >out && +test_expect_success 'rebase against main twice' ' + git rebase --apply main >out && test_i18ngrep "Current branch topic is up to date" out ' -test_expect_success 'rebase against master twice with --force' ' - git rebase --force-rebase master >out && +test_expect_success 'rebase against main twice with --force' ' + git rebase --force-rebase --apply main >out && test_i18ngrep "Current branch topic is up to date, rebase forced" out ' -test_expect_success 'rebase against master twice from another branch' ' +test_expect_success 'rebase against main twice from another branch' ' git checkout topic^ && - git rebase master topic >out && + git rebase --apply main topic >out && test_i18ngrep "Current branch topic is up to date" out ' -test_expect_success 'rebase fast-forward to master' ' +test_expect_success 'rebase fast-forward to main' ' git checkout topic^ && - git rebase topic >out && + git rebase --apply topic >out && test_i18ngrep "Fast-forwarded HEAD to topic" out ' test_expect_success 'rebase --stat' ' git reset --hard start && - git rebase --stat master >diffstat.txt && - grep "^ fileX | *1 +$" diffstat.txt + git rebase --stat main >diffstat.txt && + grep "^ fileX | *1 +$" diffstat.txt ' test_expect_success 'rebase w/config rebase.stat' ' git reset --hard start && - git config rebase.stat true && - git rebase master >diffstat.txt && - grep "^ fileX | *1 +$" diffstat.txt + git config rebase.stat true && + git rebase main >diffstat.txt && + grep "^ fileX | *1 +$" diffstat.txt ' test_expect_success 'rebase -n overrides config rebase.stat config' ' git reset --hard start && - git config rebase.stat true && - git rebase -n master >diffstat.txt && - ! grep "^ fileX | *1 +$" diffstat.txt + git config rebase.stat true && + git rebase -n main >diffstat.txt && + ! grep "^ fileX | *1 +$" diffstat.txt ' -# Output to stderr: -# -# "Does not point to a valid commit: invalid-ref" -# -# NEEDSWORK: This "grep" is fine in real non-C locales, but -# GIT_TEST_GETTEXT_POISON poisons the refname along with the enclosing -# error message. test_expect_success 'rebase --onto outputs the invalid ref' ' test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err && test_i18ngrep "invalid-ref" err @@ -95,9 +88,9 @@ test_expect_success 'GIT_REFLOG_ACTION' ' git rebase reflog-onto && git log -g --format=%gs -3 >actual && cat >expect <<-\EOF && - rebase finished: returning to refs/heads/reflog-topic - rebase: reflog-to-rebase - rebase: checkout reflog-onto + rebase (finish): returning to refs/heads/reflog-topic + rebase (pick): reflog-to-rebase + rebase (start): checkout reflog-onto EOF test_cmp expect actual && @@ -105,9 +98,9 @@ test_expect_success 'GIT_REFLOG_ACTION' ' GIT_REFLOG_ACTION=change-the-reflog git rebase reflog-onto && git log -g --format=%gs -3 >actual && cat >expect <<-\EOF && - rebase finished: returning to refs/heads/reflog-prefix - change-the-reflog: reflog-to-rebase - change-the-reflog: checkout reflog-onto + change-the-reflog (finish): returning to refs/heads/reflog-prefix + change-the-reflog (pick): reflog-to-rebase + change-the-reflog (start): checkout reflog-onto EOF test_cmp expect actual ' @@ -116,7 +109,7 @@ test_expect_success 'rebase -i onto unrelated history' ' git init unrelated && test_commit -C unrelated 1 && git -C unrelated remote add -f origin "$PWD" && - git -C unrelated branch --set-upstream-to=origin/master && + git -C unrelated branch --set-upstream-to=origin/main && git -C unrelated -c core.editor=true rebase -i -v --stat >actual && test_i18ngrep "Changes to " actual && test_i18ngrep "5 files changed" actual |