From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j6t@kdbg.org>, Eric Raible <raible@gmail.com>,
git@vger.kernel.org
Subject: Re: git merge remote branch says "Merge commit ..."?
Date: Mon, 25 May 2009 05:44:52 -0400 [thread overview]
Message-ID: <20090525094452.GC22382@coredump.intra.peff.net> (raw)
In-Reply-To: <7vljoo2mql.fsf@alter.siamese.dyndns.org>
On Sat, May 23, 2009 at 02:26:58AM -0700, Junio C Hamano wrote:
> > Right. We could probably use similar logic in "git merge". I'm not sure
> > if it is worth the trouble to end up with "Merge branch 'master' of
> > origin" instead of "Merge remote branch 'origin/master'".
>
> I do not think it is worth doing that to lose information, either.
So would you be in favor of this patch?
-- >8 --
Subject: [PATCH] merge: indicate remote tracking branches in merge message
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 not quite identical to the one I posted before; it adds the
magic "of ." at the end of the line, which matches how regular
non-remote branches are handled.
builtin-merge.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/builtin-merge.c b/builtin-merge.c
index 0b58e5e..b6f60e9 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.3.1.250.g01b8b.dirty
prev parent reply other threads:[~2009-05-25 9:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-21 19:50 git merge remote branch says "Merge commit ..."? skillzero
2009-05-22 7:49 ` Jeff King
2009-05-22 17:29 ` Eric Raible
2009-05-22 17:54 ` Jeff King
2009-05-22 18:08 ` git merge remote branch says Eric Raible
2009-05-22 18:10 ` Jeff King
2009-05-22 18:30 ` git merge remote branch says "Merge commit ..."? Johannes Sixt
2009-05-23 9:17 ` Jeff King
2009-05-23 9:26 ` Junio C Hamano
2009-05-25 9:44 ` Jeff King [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090525094452.GC22382@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=raible@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).