git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] merge: indicate remote tracking branches in merge message
@ 2009-08-09  6:59 Jeff King
  2009-08-09  7:14 ` Jeff King
  2009-08-09  7:31 ` Junio C Hamano
  0 siblings, 2 replies; 12+ messages in thread
From: Jeff King @ 2009-08-09  6:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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 <peff@peff.net>
---
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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-08-09 21:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-09  6:59 [PATCH] merge: indicate remote tracking branches in merge message Jeff King
2009-08-09  7:14 ` Jeff King
2009-08-09  7:31 ` Junio C Hamano
2009-08-09  7:40   ` Jeff King
2009-08-09  9:14     ` Jeff King
2009-08-09 10:00       ` Jeff King
2009-08-09 10:01         ` [PATCH 1/3] add tests for merge message headings Jeff King
2009-08-09 10:02         ` [PATCH 2/3] merge: fix incorrect merge message for ambiguous tag/branch Jeff King
2009-08-09 10:02         ` [PATCH 3/3] merge: indicate remote tracking branches in merge message Jeff King
2009-08-09 10:07         ` [PATCH] " Jeff King
2009-08-09 19:36           ` Junio C Hamano
2009-08-09 21:49             ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).