From: Junio C Hamano Date: Sun, 16 Aug 2009 11:13:04 +0000 (-0700) Subject: Merge branch 'jk/maint-merge-msg-fix' X-Git-Tag: v1.6.5-rc0~68 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b21f9e7f860620571667fba33ed511bed59dfb14?ds=inline;hp=-c Merge branch 'jk/maint-merge-msg-fix' * jk/maint-merge-msg-fix: merge: indicate remote tracking branches in merge message merge: fix incorrect merge message for ambiguous tag/branch add tests for merge message headings --- b21f9e7f860620571667fba33ed511bed59dfb14 diff --combined builtin-merge.c index 0b12fb3155,f4de73fa9d..b6b84286b2 --- a/builtin-merge.c +++ b/builtin-merge.c @@@ -358,6 -358,7 +358,7 @@@ static void merge_name(const char *remo 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 +369,17 @@@ 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 ~ */ @@@ -594,7 -598,7 +598,7 @@@ static int try_merge_strategy(const cha discard_cache(); if (read_cache() < 0) die("failed to read the cache"); - return -ret; + return ret; } }