Re* git merge <tag> behavior
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 19, 2013, 17:54 UTC
- Message-ID
- <7v7gl3jmx0.fsf_-_@alter.siamese.dyndns.org>
- In-Reply-To
- <7vfvzrjrad.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
>> 2) git merge <tag> VS git merge <object-id> >> ... >> It would be great to have Git using the tag message and check the >> signature. > > Perhaps, but if you feed the $(git rev-parse v1.12.2) to merge, your > subject will not be able to say "Merge tag 'v1.12.2'" in the first > place, so I do not think you would want to encourage such usage in > the first place.
A patch to do so may look like this. You would probably want to also do read_sha1_file(desc->obj->sha1) here and parse out the header line "tag " to replace the "remote" to recover the symbolic tag name, but I didn't bother in this illustration.
diff --git a/builtin/merge.c b/builtin/merge.c index 0ec8f0d..990e90c 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -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: