diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-07-30 01:50:01 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-07-30 22:43:10 +0300 |
commit | 6e6029a82acdb3d785eef15dc798f4d86c4ea445 (patch) | |
tree | ddca4033ffaca8df143cb20e918d045b15228587 /t/t6200-fmt-merge-msg.sh | |
parent | 21531927e4e1b9fdf524983414ee59558cb4f3d6 (diff) |
fmt-merge-msg: allow merge destination to be omitted again
In Git 2.28, we stopped special casing 'master' when producing the
default merge message by just removing the code to squelch "into
'master'" at the end of the message.
Introduce multi-valued merge.suppressDest configuration variable
that gives a set of globs to match against the name of the branch
into which the merge is being made, to let users specify for which
branch fmt-merge-msg's output should be shortened. When it is not
set, 'master' is used as the sole value of the variable by default.
The above move mostly reverts the pre-2.28 default in repositories
that have no relevant configuration.
Add a few tests to protect the behaviour with the new configuration
variable from future regression.
Helped-by: Linus Torvalds <torvalds@linux-foundation.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6200-fmt-merge-msg.sh')
-rwxr-xr-x | t/t6200-fmt-merge-msg.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh index e4c2a6eca4..7d549748ef 100755 --- a/t/t6200-fmt-merge-msg.sh +++ b/t/t6200-fmt-merge-msg.sh @@ -542,4 +542,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 master && + git commit --allow-empty -m "One step ahead" && + git checkout master && + 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 master" 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 master$" actual && + + git -c merge.suppressDest="ma??er" fmt-merge-msg <.git/FETCH_HEAD >full.3 && + head -n1 full.3 >actual && + grep -e "Merge branch .side." actual && + ! grep -e " into master$" actual +' + test_done |