summaryrefslogtreecommitdiff
path: root/builtin-merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-08-16 04:13:04 -0700
committerJunio C Hamano <gitster@pobox.com>2009-08-16 04:13:04 -0700
commitb21f9e7f860620571667fba33ed511bed59dfb14 (patch)
tree1cb50257a9c0f179c88f81014064d079d5b416c8 /builtin-merge.c
parent1d7d6ad539fabd49421d8ef7b27c0f287430bc7d (diff)
parent69a8b7c74192dfa7bde3937d2c84324a2cd1506b (diff)
downloadgit-b21f9e7f860620571667fba33ed511bed59dfb14.tar.gz
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
Diffstat (limited to 'builtin-merge.c')
-rw-r--r--builtin-merge.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/builtin-merge.c b/builtin-merge.c
index 0b12fb3155..b6b84286b2 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 <name>^^^.. or <name>~<number> */