merge: do not mistake (ancestor of) tag for branch
If no branch 'foo' exists but a tag 'foo' does, then git merge foo^ results in Merge branch 'foo' (early part) as a commit message, because the relevant code path checks that refs/heads/foo is a valid refname for writing rather than for reading. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
64fdc08dac
commit
b81f925f70
@ -437,7 +437,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
|
||||
strbuf_addstr(&truname, "refs/heads/");
|
||||
strbuf_addstr(&truname, remote);
|
||||
strbuf_setlen(&truname, truname.len - len);
|
||||
if (resolve_ref(truname.buf, buf_sha, 0, NULL)) {
|
||||
if (resolve_ref(truname.buf, buf_sha, 1, NULL)) {
|
||||
strbuf_addf(msg,
|
||||
"%s\t\tbranch '%s'%s of .\n",
|
||||
sha1_to_hex(remote_head->sha1),
|
||||
|
Reference in New Issue
Block a user