[PATCH] merge: indicate remote tracking branches in merge message
From: Jeff King <hidden>
Date: 2016-06-15 22:47:12
Subsystem:
the rest · Maintainer:
Linus Torvalds
Previously when merging directly from a local tracking
branch like:
git merge origin/master
The merge message said:
Merge commit 'origin/master'
* commit 'origin/master':
...
Instead, let's be more explicit about what we are merging:
Merge remote branch 'origin/master'
* origin/master:
...
We accomplish this by recognizing remote tracking branches
in git-merge when we build the simulated FETCH_HEAD output
that we feed to fmt-merge-msg.
Signed-off-by: Jeff King <redacted>
---
This is a repost of
http://article.gmane.org/gmane.comp.version-control.git/119909
which got no response from you. I think it is a good idea, but I am not
deeply committed to it. I mainly want a yes or no so I can clean it out
of my patch queue.
builtin-merge.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/builtin-merge.c b/builtin-merge.c
index 0b12fb3..c5688e1 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c@@ -378,6 +378,17 @@ static void merge_name(const char *remote, struct strbuf *msg) goto cleanup; } + strbuf_setlen(&buf, 0); + strbuf_addstr(&buf, "refs/remotes/"); + strbuf_addstr(&buf, remote); + resolve_ref(buf.buf, branch_head, 0, 0); + + if (!hashcmp(remote_head->sha1, branch_head)) { + 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> */ for (len = 0, ptr = remote + strlen(remote); remote < ptr && ptr[-1] == '^';
--
1.6.4.72.g50730