diff options
Diffstat (limited to 't/t3412-rebase-root.sh')
-rwxr-xr-x | t/t3412-rebase-root.sh | 60 |
1 files changed, 13 insertions, 47 deletions
diff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh index 21632a984e..19c6f4acbf 100755 --- a/t/t3412-rebase-root.sh +++ b/t/t3412-rebase-root.sh @@ -4,6 +4,9 @@ test_description='git rebase --root Tests if git rebase --root --onto <newparent> can rebase the root commit. ' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh log_with_names () { @@ -24,7 +27,7 @@ test_expect_success 'prepare repository' ' test_expect_success 'rebase --root fails with too many args' ' git checkout -B fail other && - test_must_fail git rebase --onto master --root fail fail + test_must_fail git rebase --onto main --root fail fail ' test_expect_success 'setup pre-rebase hook' ' @@ -44,7 +47,7 @@ EOF test_expect_success 'rebase --root --onto <newbase>' ' git checkout -b work other && - git rebase --root --onto master && + git rebase --root --onto main && git log --pretty=tformat:"%s" > rebased && test_cmp expect rebased ' @@ -55,7 +58,7 @@ test_expect_success 'pre-rebase got correct input (1)' ' test_expect_success 'rebase --root --onto <newbase> <branch>' ' git branch work2 other && - git rebase --root --onto master work2 && + git rebase --root --onto main work2 && git log --pretty=tformat:"%s" > rebased2 && test_cmp expect rebased2 ' @@ -66,7 +69,7 @@ test_expect_success 'pre-rebase got correct input (2)' ' test_expect_success 'rebase -i --root --onto <newbase>' ' git checkout -b work3 other && - git rebase -i --root --onto master && + git rebase -i --root --onto main && git log --pretty=tformat:"%s" > rebased3 && test_cmp expect rebased3 ' @@ -77,7 +80,7 @@ test_expect_success 'pre-rebase got correct input (3)' ' test_expect_success 'rebase -i --root --onto <newbase> <branch>' ' git branch work4 other && - git rebase -i --root --onto master work4 && + git rebase -i --root --onto main work4 && git log --pretty=tformat:"%s" > rebased4 && test_cmp expect rebased4 ' @@ -86,17 +89,6 @@ test_expect_success 'pre-rebase got correct input (4)' ' test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,work4 ' -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 REBASE_P 'pre-rebase got correct input (5)' ' - test "z$(cat .git/PRE-REBASE-INPUT)" = z--root, -' - test_expect_success 'set up merge history' ' git checkout other^ && git checkout -b side && @@ -120,13 +112,6 @@ commit work6~4 1 EOF -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 && - test_cmp expect-side rebased6 -' - test_expect_success 'set up second root and merge' ' git symbolic-ref HEAD refs/heads/third && rm .git/index && @@ -155,13 +140,6 @@ commit work7~5 1 EOF -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 && - test_cmp expect-third rebased7 -' - test_expect_success 'setup pre-rebase hook that fails' ' mkdir -p .git/hooks && cat >.git/hooks/pre-rebase <<EOF && @@ -173,14 +151,14 @@ EOF test_expect_success 'pre-rebase hook stops rebase' ' git checkout -b stops1 other && - test_must_fail git rebase --root --onto master && + test_must_fail git rebase --root --onto main && test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1 && test 0 = $(git rev-list other...stops1 | wc -l) ' test_expect_success 'pre-rebase hook stops rebase -i' ' git checkout -b stops2 other && - test_must_fail git rebase --root --onto master && + test_must_fail git rebase --root --onto main && test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2 && test 0 = $(git rev-list other...stops2 | wc -l) ' @@ -190,7 +168,7 @@ test_expect_success 'remove pre-rebase hook' ' ' test_expect_success 'set up a conflict' ' - git checkout master && + git checkout main && echo conflict > B && git add B && git commit -m conflict @@ -198,7 +176,7 @@ test_expect_success 'set up a conflict' ' test_expect_success 'rebase --root with conflict (first part)' ' git checkout -b conflict1 other && - test_must_fail git rebase --root --onto master && + test_must_fail git rebase --root --onto main && git ls-files -u | grep "B$" ' @@ -225,7 +203,7 @@ test_expect_success 'rebase --root with conflict (second part)' ' test_expect_success 'rebase -i --root with conflict (first part)' ' git checkout -b conflict2 other && - test_must_fail git rebase -i --root --onto master && + test_must_fail git rebase -i --root --onto main && git ls-files -u | grep "B$" ' @@ -261,21 +239,9 @@ commit conflict3~6 1 EOF -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$" -' - test_expect_success 'fix the conflict' ' echo 3 > B && git add B ' -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 -' - test_done |