Skip to content

Commit 57b58db

Browse files
committed
merge: notice local merging of tags and keep it unwrapped
This also updates the autogenerated merge title message from "merge commit X" to "merge tag X", and its effect can be seen in the changes to the test suite. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7a2b128 commit 57b58db

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

builtin/merge.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ static void merge_name(const char *remote, struct strbuf *msg)
441441
sha1_to_hex(branch_head), remote);
442442
goto cleanup;
443443
}
444+
if (!prefixcmp(found_ref, "refs/tags/")) {
445+
strbuf_addf(msg, "%s\t\ttag '%s' of .\n",
446+
sha1_to_hex(branch_head), remote);
447+
goto cleanup;
448+
}
444449
if (!prefixcmp(found_ref, "refs/remotes/")) {
445450
strbuf_addf(msg, "%s\t\tremote-tracking branch '%s' of .\n",
446451
sha1_to_hex(branch_head), remote);

t/t4202-log.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,11 @@ test_expect_success 'set up more tangled history' '
346346
'
347347

348348
cat > expect <<\EOF
349-
* Merge commit 'reach'
349+
* Merge tag 'reach'
350350
|\
351351
| \
352352
| \
353-
*-. \ Merge commit 'octopus-a'; commit 'octopus-b'
353+
*-. \ Merge tags 'octopus-a' and 'octopus-b'
354354
|\ \ \
355355
* | | | seventh
356356
| | * | octopus-b

t/t7600-merge.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
3838
>empty
3939

4040
create_merge_msgs () {
41-
echo "Merge commit 'c2'" >msg.1-5 &&
42-
echo "Merge commit 'c2'; commit 'c3'" >msg.1-5-9 &&
41+
echo "Merge tag 'c2'" >msg.1-5 &&
42+
echo "Merge tags 'c2' and 'c3'" >msg.1-5-9 &&
4343
{
4444
echo "Squashed commit of the following:" &&
4545
echo &&
@@ -57,7 +57,7 @@ create_merge_msgs () {
5757
} >squash.1-5-9 &&
5858
echo >msg.nolog &&
5959
{
60-
echo "* commit 'c3':" &&
60+
echo "* tag 'c3':" &&
6161
echo " commit 3" &&
6262
echo
6363
} >msg.log

t/t7604-merge-custom-message.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ create_merge_msgs() {
1111

1212
cp exp.subject exp.log &&
1313
echo >>exp.log "" &&
14-
echo >>exp.log "* commit 'c2':" &&
14+
echo >>exp.log "* tag 'c2':" &&
1515
echo >>exp.log " c2"
1616
}
1717

t/t7608-merge-messages.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test_expect_success 'merge tag' '
3535
git checkout master &&
3636
test_commit master-3 &&
3737
git merge tag-1 &&
38-
check_oneline "Merge commit Qtag-1Q"
38+
check_oneline "Merge tag Qtag-1Q"
3939
'
4040

4141
test_expect_success 'ambiguous tag' '
@@ -44,7 +44,7 @@ test_expect_success 'ambiguous tag' '
4444
git checkout master &&
4545
test_commit master-4 &&
4646
git merge ambiguous &&
47-
check_oneline "Merge commit QambiguousQ"
47+
check_oneline "Merge tag QambiguousQ"
4848
'
4949

5050
test_expect_success 'remote-tracking branch' '

0 commit comments

Comments
 (0)