diff options
Diffstat (limited to 't/t3505-cherry-pick-empty.sh')
-rwxr-xr-x | t/t3505-cherry-pick-empty.sh | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh index 5f911bb529..eba3c38d5a 100755 --- a/t/t3505-cherry-pick-empty.sh +++ b/t/t3505-cherry-pick-empty.sh @@ -2,6 +2,9 @@ test_description='test cherry-picking an empty commit' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh test_expect_success setup ' @@ -17,7 +20,7 @@ test_expect_success setup ' test_tick && git commit --allow-empty-message -m "" && - git checkout master && + git checkout main && git checkout -b empty-change-branch && test_tick && git commit --allow-empty -m "empty" @@ -25,7 +28,7 @@ test_expect_success setup ' ' test_expect_success 'cherry-pick an empty commit' ' - git checkout master && + git checkout main && test_expect_code 1 git cherry-pick empty-change-branch ' @@ -35,7 +38,7 @@ test_expect_success 'index lockfile was removed' ' test_expect_success 'cherry-pick a commit with an empty message' ' test_when_finished "git reset --hard empty-message-branch~1" && - git checkout master && + git checkout main && git cherry-pick empty-message-branch ' @@ -44,12 +47,12 @@ test_expect_success 'index lockfile was removed' ' ' test_expect_success 'cherry-pick a commit with an empty message with --allow-empty-message' ' - git checkout -f master && + git checkout -f main && git cherry-pick --allow-empty-message empty-message-branch ' test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' ' - git checkout master && + git checkout main && echo fourth >>file2 && git add file2 && git commit -m "fourth" && @@ -57,22 +60,22 @@ test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' ' ' test_expect_success 'cherry pick an empty non-ff commit with --allow-empty' ' - git checkout master && + git checkout main && git cherry-pick --allow-empty empty-change-branch ' test_expect_success 'cherry pick with --keep-redundant-commits' ' - git checkout master && + git checkout main && git cherry-pick --keep-redundant-commits HEAD^ ' test_expect_success 'cherry-pick a commit that becomes no-op (prep)' ' - git checkout master && + git checkout main && git branch fork && echo foo >file2 && git add file2 && test_tick && - git commit -m "add file2 on master" && + git commit -m "add file2 on main" && git checkout fork && echo foo >file2 && @@ -84,15 +87,15 @@ test_expect_success 'cherry-pick a commit that becomes no-op (prep)' ' test_expect_success 'cherry-pick a no-op without --keep-redundant' ' git reset --hard && git checkout fork^0 && - test_must_fail git cherry-pick master + test_must_fail git cherry-pick main ' test_expect_success 'cherry-pick a no-op with --keep-redundant' ' git reset --hard && git checkout fork^0 && - git cherry-pick --keep-redundant-commits master && + git cherry-pick --keep-redundant-commits main && git show -s --format=%s >actual && - echo "add file2 on master" >expect && + echo "add file2 on main" >expect && test_cmp expect actual ' |