diff options
Diffstat (limited to 't/t3507-cherry-pick-conflict.sh')
-rwxr-xr-x | t/t3507-cherry-pick-conflict.sh | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index 752bc43487..014001b8f3 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -9,6 +9,9 @@ test_description='test cherry-pick and revert with conflicts ' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh pristine_detach () { @@ -29,7 +32,7 @@ test_expect_success setup ' test_commit redundant-pick foo c redundant && git commit --allow-empty --allow-empty-message && git tag empty && - git checkout master && + git checkout main && git config advice.detachedhead false ' @@ -56,7 +59,7 @@ test_expect_success 'advice from failed cherry-pick' " EOF test_must_fail git cherry-pick picked 2>actual && - test_i18ncmp expected actual + test_cmp expected actual " test_expect_success 'advice from failed cherry-pick --no-commit' " @@ -70,7 +73,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' " EOF test_must_fail git cherry-pick --no-commit picked 2>actual && - test_i18ncmp expected actual + test_cmp expected actual " test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' ' @@ -253,7 +256,7 @@ test_expect_success \ test_must_fail git cherry-pick picked && - test_i18ncmp expected .git/MERGE_MSG + test_cmp expected .git/MERGE_MSG ' test_expect_success \ @@ -273,7 +276,7 @@ test_expect_success \ test_must_fail git cherry-pick --cleanup=scissors picked && - test_i18ncmp expected .git/MERGE_MSG + test_cmp expected .git/MERGE_MSG ' test_expect_success 'failed cherry-pick describes conflict in work tree' ' @@ -283,12 +286,12 @@ test_expect_success 'failed cherry-pick describes conflict in work tree' ' a ======= c - >>>>>>> objid picked + >>>>>>> objid (picked) EOF test_must_fail git cherry-pick picked && - sed "s/[a-f0-9]*\.\.\./objid/" foo >actual && + sed "s/[a-f0-9]* (/objid (/" foo >actual && test_cmp expected actual ' @@ -298,16 +301,16 @@ test_expect_success 'diff3 -m style' ' cat <<-EOF >expected && <<<<<<< HEAD a - ||||||| parent of objid picked + ||||||| parent of objid (picked) b ======= c - >>>>>>> objid picked + >>>>>>> objid (picked) EOF test_must_fail git cherry-pick picked && - sed "s/[a-f0-9]*\.\.\./objid/" foo >actual && + sed "s/[a-f0-9]* (/objid (/" foo >actual && test_cmp expected actual ' @@ -319,7 +322,7 @@ test_expect_success 'revert also handles conflicts sanely' ' a ======= b - >>>>>>> parent of objid picked + >>>>>>> parent of objid (picked) EOF { git checkout picked -- foo && @@ -345,7 +348,7 @@ test_expect_success 'revert also handles conflicts sanely' ' test_must_fail git update-index --refresh -q && test_must_fail git diff-index --exit-code HEAD && test_cmp expected-stages actual-stages && - sed "s/[a-f0-9]*\.\.\./objid/" foo >actual && + sed "s/[a-f0-9]* (/objid (/" foo >actual && test_cmp expected actual ' @@ -429,16 +432,16 @@ test_expect_success 'revert conflict, diff3 -m style' ' cat <<-EOF >expected && <<<<<<< HEAD a - ||||||| objid picked + ||||||| objid (picked) c ======= b - >>>>>>> parent of objid picked + >>>>>>> parent of objid (picked) EOF test_must_fail git revert picked && - sed "s/[a-f0-9]*\.\.\./objid/" foo >actual && + sed "s/[a-f0-9]* (/objid (/" foo >actual && test_cmp expected actual ' @@ -462,7 +465,7 @@ test_expect_success \ test_must_fail git revert picked && sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual && - test_i18ncmp expected actual + test_cmp expected actual ' test_expect_success \ @@ -485,7 +488,7 @@ test_expect_success \ test_must_fail git revert --cleanup=scissors picked && sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual && - test_i18ncmp expected actual + test_cmp expected actual ' test_expect_success 'failed cherry-pick does not forget -s' ' @@ -512,7 +515,7 @@ test_expect_success 'commit after failed cherry-pick adds -s at the right place' Signed-off-by: C O Mitter <committer@example.com> # Conflicts: EOF - grep -e "^# Conflicts:" -e '^Signed-off-by' .git/COMMIT_EDITMSG >actual && + grep -e "^# Conflicts:" -e "^Signed-off-by" .git/COMMIT_EDITMSG >actual && test_cmp expect actual && cat <<-\EOF >expected && @@ -541,7 +544,7 @@ test_expect_success 'commit --amend -s places the sign-off at the right place' ' Signed-off-by: C O Mitter <committer@example.com> Conflicts: EOF - grep -e "^Conflicts:" -e '^Signed-off-by' .git/COMMIT_EDITMSG >actual && + grep -e "^Conflicts:" -e "^Signed-off-by" .git/COMMIT_EDITMSG >actual && test_cmp expect actual ' |