From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] merge: indicate remote tracking branches in merge message
Date: Sun, 9 Aug 2009 03:14:46 -0400 [thread overview]
Message-ID: <20090809071446.GA24221@coredump.intra.peff.net> (raw)
In-Reply-To: <20090809065936.GA24112@coredump.intra.peff.net>
On Sun, Aug 09, 2009 at 02:59:36AM -0400, Jeff King wrote:
> 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.
Ah, it may have had to do with the fact that it doesn't actually pass
the tests. There is a trivial text update needed in t3409, which calls
"git merge origin/master" during its setup phase.
Updated, passing-all-tests patch is below. Sorry for the confusion.
-- >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>
---
builtin-merge.c | 11 +++++++++++
t/t3409-rebase-preserve-merges.sh | 2 +-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/builtin-merge.c b/builtin-merge.c
index 82b5466..1f59567 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] == '^';
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
index e6c8327..2ce0236 100755
--- a/t/t3409-rebase-preserve-merges.sh
+++ b/t/t3409-rebase-preserve-merges.sh
@@ -71,7 +71,7 @@ test_expect_success 'rebase -p fakes interactive rebase' '
git fetch &&
git rebase -p origin/topic &&
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
- test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
+ test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote branch" | wc -l)
)
'
--
1.6.4.178.g7a987
next prev parent reply other threads:[~2009-08-09 7:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-09 6:59 [PATCH] merge: indicate remote tracking branches in merge message Jeff King
2009-08-09 7:14 ` Jeff King [this message]
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
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=20090809071446.GA24221@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).