Skip to content

Commit 2d1495f

Browse files
committed
merge: a random object may not necssarily be a commit
The user could have said "git merge $(git rev-parse v1.0.0)"; we shouldn't mark it as "Merge commit '15999998fb...'" as the merge name, even though such an invocation might be crazy. We could even read the "tag " header from the tag object and replace the object name the user gave us, but let's not lose the information by doing so, at least not yet. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1599999 commit 2d1495f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

builtin/merge.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,19 @@ static void merge_name(const char *remote, struct strbuf *msg)
516516
strbuf_release(&line);
517517
goto cleanup;
518518
}
519+
520+
if (remote_head->util) {
521+
struct merge_remote_desc *desc;
522+
desc = merge_remote_util(remote_head);
523+
if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
524+
strbuf_addf(msg, "%s\t\t%s '%s'\n",
525+
sha1_to_hex(desc->obj->sha1),
526+
typename(desc->obj->type),
527+
remote);
528+
goto cleanup;
529+
}
530+
}
531+
519532
strbuf_addf(msg, "%s\t\tcommit '%s'\n",
520533
sha1_to_hex(remote_head->object.sha1), remote);
521534
cleanup:

0 commit comments

Comments
 (0)