diff options
Diffstat (limited to 't/t6200-fmt-merge-msg.sh')
-rwxr-xr-x | t/t6200-fmt-merge-msg.sh | 89 |
1 files changed, 65 insertions, 24 deletions
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh index 93f23cfa82..44f55d93fe 100755 --- a/t/t6200-fmt-merge-msg.sh +++ b/t/t6200-fmt-merge-msg.sh @@ -5,7 +5,11 @@ test_description='fmt-merge-msg test' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh +. "$TEST_DIRECTORY/lib-gpg.sh" test_expect_success setup ' echo one >one && @@ -66,32 +70,49 @@ test_expect_success setup ' git commit -a -m "Right #5" && git checkout -b long && - i=0 && - while test $i -lt 30 - do - test_commit $i one && - i=$(($i+1)) - done && + test_commit_bulk --start=0 --message=%s --filename=one 30 && git show-branch && apos="'\''" ' +test_expect_success GPG 'set up a signed tag' ' + git tag -s -m signed-tag-msg signed-good-tag left +' + test_expect_success 'message for merging local branch' ' echo "Merge branch ${apos}left${apos}" >expected && - git checkout master && + git checkout main && git fetch . left && git fmt-merge-msg <.git/FETCH_HEAD >actual && test_cmp expected actual ' +test_expect_success GPG 'message for merging local tag signed by good key' ' + git checkout main && + git fetch . signed-good-tag && + git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 && + grep "^Merge tag ${apos}signed-good-tag${apos}" actual && + grep "^# gpg: Signature made" actual && + grep "^# gpg: Good signature from" actual +' + +test_expect_success GPG 'message for merging local tag signed by unknown key' ' + git checkout main && + git fetch . signed-good-tag && + GNUPGHOME=. git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 && + grep "^Merge tag ${apos}signed-good-tag${apos}" actual && + grep "^# gpg: Signature made" actual && + grep -E "^# gpg: Can${apos}t check signature: (public key not found|No public key)" actual +' + test_expect_success 'message for merging external branch' ' echo "Merge branch ${apos}left${apos} of $(pwd)" >expected && - git checkout master && + git checkout main && git fetch "$(pwd)" left && git fmt-merge-msg <.git/FETCH_HEAD >actual && @@ -115,7 +136,7 @@ test_expect_success '[merge] summary/log configuration' ' test_config merge.log true && test_unconfig merge.summary && - git checkout master && + git checkout main && test_tick && git fetch . left && @@ -124,7 +145,7 @@ test_expect_success '[merge] summary/log configuration' ' test_unconfig merge.log && test_config merge.summary true && - git checkout master && + git checkout main && test_tick && git fetch . left && @@ -135,7 +156,7 @@ test_expect_success '[merge] summary/log configuration' ' ' test_expect_success 'setup FETCH_HEAD' ' - git checkout master && + git checkout main && test_tick && git fetch . left ' @@ -263,7 +284,7 @@ test_expect_success 'fmt-merge-msg -m' ' test_unconfig merge.log && test_unconfig merge.summary && - git checkout master && + git checkout main && git fetch "$(pwd)" left && git fmt-merge-msg -m "Sync with left" <.git/FETCH_HEAD >actual && git fmt-merge-msg --log -m "Sync with left" \ @@ -305,28 +326,28 @@ test_expect_success 'setup: expected shortlog for two branches' ' test_expect_success 'shortlog for two branches' ' test_config merge.log true && test_unconfig merge.summary && - git checkout master && + git checkout main && test_tick && git fetch . left right && git fmt-merge-msg <.git/FETCH_HEAD >actual1 && test_unconfig merge.log && test_config merge.summary true && - git checkout master && + git checkout main && test_tick && git fetch . left right && git fmt-merge-msg <.git/FETCH_HEAD >actual2 && test_config merge.log yes && test_unconfig merge.summary && - git checkout master && + git checkout main && test_tick && git fetch . left right && git fmt-merge-msg <.git/FETCH_HEAD >actual3 && test_unconfig merge.log && test_config merge.summary yes && - git checkout master && + git checkout main && test_tick && git fetch . left right && git fmt-merge-msg <.git/FETCH_HEAD >actual4 && @@ -340,7 +361,7 @@ test_expect_success 'shortlog for two branches' ' test_expect_success 'merge-msg -F' ' test_unconfig merge.log && test_config merge.summary yes && - git checkout master && + git checkout main && test_tick && git fetch . left right && git fmt-merge-msg -F .git/FETCH_HEAD >actual && @@ -350,7 +371,7 @@ test_expect_success 'merge-msg -F' ' test_expect_success 'merge-msg -F in subdirectory' ' test_unconfig merge.log && test_config merge.summary yes && - git checkout master && + git checkout main && test_tick && git fetch . left right && mkdir sub && @@ -390,7 +411,7 @@ test_expect_success 'merge-msg tag' ' test_unconfig merge.log && test_config merge.summary yes && - git checkout master && + git checkout main && test_tick && git fetch . tag tag-r3 && @@ -420,7 +441,7 @@ test_expect_success 'merge-msg two tags' ' test_unconfig merge.log && test_config merge.summary yes && - git checkout master && + git checkout main && test_tick && git fetch . tag tag-r3 tag tag-l5 && @@ -450,7 +471,7 @@ test_expect_success 'merge-msg tag and branch' ' test_unconfig merge.log && test_config merge.summary yes && - git checkout master && + git checkout main && test_tick && git fetch . tag tag-r3 left && @@ -477,7 +498,7 @@ test_expect_success 'merge-msg lots of commits' ' test_config merge.summary yes && - git checkout master && + git checkout main && test_tick && git fetch . long && @@ -488,11 +509,11 @@ test_expect_success 'merge-msg lots of commits' ' test_expect_success 'merge-msg with "merging" an annotated tag' ' test_config merge.log true && - git checkout master^0 && + git checkout main^0 && git commit --allow-empty -m "One step ahead" && git tag -a -m "An annotated one" annote HEAD && - git checkout master && + git checkout main && git fetch . annote && git fmt-merge-msg <.git/FETCH_HEAD >actual && @@ -524,4 +545,24 @@ test_expect_success 'merge-msg with "merging" an annotated tag' ' test_cmp expected .git/MERGE_MSG ' +test_expect_success 'merge.suppressDest configuration' ' + git checkout -B side main && + git commit --allow-empty -m "One step ahead" && + git checkout main && + git fetch . side && + + git -c merge.suppressDest="" fmt-merge-msg <.git/FETCH_HEAD >full.1 && + head -n1 full.1 >actual && + grep -e "Merge branch .side. into main" actual && + + git -c merge.suppressDest="mast" fmt-merge-msg <.git/FETCH_HEAD >full.2 && + head -n1 full.2 >actual && + grep -e "Merge branch .side. into main$" actual && + + git -c merge.suppressDest="ma?*[rn]" fmt-merge-msg <.git/FETCH_HEAD >full.3 && + head -n1 full.3 >actual && + grep -e "Merge branch .side." actual && + ! grep -e " into main$" actual +' + test_done |