Skip to content

Commit

Permalink
merge: a random object may not necssarily be a commit
Browse files Browse the repository at this point in the history
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 <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Mar 19, 2013
1 parent 1599999 commit 2d1495f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,19 @@ static void merge_name(const char *remote, struct strbuf *msg)
strbuf_release(&line);
goto cleanup;
}

if (remote_head->util) {
struct merge_remote_desc *desc;
desc = merge_remote_util(remote_head);
if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
strbuf_addf(msg, "%s\t\t%s '%s'\n",
sha1_to_hex(desc->obj->sha1),
typename(desc->obj->type),
remote);
goto cleanup;
}
}

strbuf_addf(msg, "%s\t\tcommit '%s'\n",
sha1_to_hex(remote_head->object.sha1), remote);
cleanup:
Expand Down

0 comments on commit 2d1495f

Please sign in to comment.