X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-merge.c;h=b6b84286b26a4317dfd5185ae83fd861c6f9fa7d;hb=e4d1afbcf2e39a997ae90befd629ee53e444c4c9;hp=0b12fb31558d1cb59f9e2a8ab049ea944fe3060e;hpb=38a9f35d1f7d2d90dafbbf4c45ac9500260eaeb0;p=git.git diff --git a/builtin-merge.c b/builtin-merge.c index 0b12fb315..b6b84286b 100644 --- a/builtin-merge.c +++ b/builtin-merge.c @@ -358,6 +358,7 @@ static void merge_name(const char *remote, struct strbuf *msg) struct strbuf buf = STRBUF_INIT; struct strbuf bname = STRBUF_INIT; const char *ptr; + char *found_ref; int len, early; strbuf_branchname(&bname, remote); @@ -368,14 +369,17 @@ static void merge_name(const char *remote, struct strbuf *msg) if (!remote_head) die("'%s' does not point to a commit", remote); - strbuf_addstr(&buf, "refs/heads/"); - strbuf_addstr(&buf, remote); - resolve_ref(buf.buf, branch_head, 0, NULL); - - if (!hashcmp(remote_head->sha1, branch_head)) { - strbuf_addf(msg, "%s\t\tbranch '%s' of .\n", - sha1_to_hex(branch_head), remote); - goto cleanup; + if (dwim_ref(remote, strlen(remote), branch_head, &found_ref) > 0) { + if (!prefixcmp(found_ref, "refs/heads/")) { + strbuf_addf(msg, "%s\t\tbranch '%s' of .\n", + sha1_to_hex(branch_head), remote); + goto cleanup; + } + if (!prefixcmp(found_ref, "refs/remotes/")) { + strbuf_addf(msg, "%s\t\tremote branch '%s' of .\n", + sha1_to_hex(branch_head), remote); + goto cleanup; + } } /* See if remote matches ^^^.. or ~ */