git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] merge: indicate remote tracking branches in merge message

From
Jeff King <peff@peff.net>
Date
Aug 9, 2009, 09:14 UTC
Message-ID
<20090809091443.GA676@coredump.intra.peff.net>
In-Reply-To
<20090809074035.GA4778@coredump.intra.peff.net>
On Sun, Aug 09, 2009 at 03:40:35AM -0400, Jeff King wrote:
Show 9 quoted lines
> > Shouldn't it instead feed what it got from the end user to the dwim
> > machinery, and make sure it dwims into refs/remotes/ hierarchy?
> 
> I'm not sure that is all that different in practice than what is
> happening now. Mainly I did it the way I did so that I didn't touch the
> code path for detecting local branches.
> 
> But assuming they are functionally identical, I think your patch is much
> more readable.

I tested your patch; the two methods aren't identical. In fact, yours fixes a bug. :)

In t4202, we have a branch name and a tag name that are the same (octopus-a), and we "git merge octopus-a". This actually merges the tag, but because the branch name existed, we write "Merge branch 'octopus-a'" in the log, which is not true. With your patch, it does the right thing and says "Merge commit 'octopus-a'".

The simple thing is to just update the "expect" text. Though the current behavior does show off the ability to collape the two branches and say

  Merge branches 'octopus-a' and 'octopus-b'
instead of
  Merge commit 'octopus-a'; commit 'octopus-b'
which we could preserve that by renaming the tags, as below.
---
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 48e0088..9d0db2a 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -306,13 +306,13 @@ test_expect_success 'set up more tangled history' '
 	git checkout master &&
 	git merge tangle &&
 	git checkout -b reach &&
-	test_commit reach &&
+	test_commit reach-1 &&
 	git checkout master &&
 	git checkout -b octopus-a &&
-	test_commit octopus-a &&
+	test_commit octopus-a-1 &&
 	git checkout master &&
 	git checkout -b octopus-b &&
-	test_commit octopus-b &&
+	test_commit octopus-b-1 &&
 	git checkout master &&
 	test_commit seventh &&
 	git merge octopus-a octopus-b
@@ -327,12 +327,12 @@ cat > expect <<\EOF
 *-. \   Merge branches 'octopus-a' and 'octopus-b'
 |\ \ \
 * | | | seventh
-| | * | octopus-b
+| | * | octopus-b-1
 | |/ /
 |/| |
-| * | octopus-a
+| * | octopus-a-1
 |/ /
-| * reach
+| * reach-1
 |/
 *   Merge branch 'tangle'
 |\
Previous: Jeff KingNext: Jeff King
Message 5 of 12 in “merge: indicate remote tracking branches in merge message”
  1. merge: indicate remote tracking branches in merge messageJeff King, Aug 9, 2009
  2. Jeff KingAug 9, 2009
  3. Junio C HamanoAug 9, 2009
  4. Jeff KingAug 9, 2009
  5. Jeff KingAug 9, 2009
  6. Jeff KingAug 9, 2009
  7. 1/3 add tests for merge message headingsJeff King, Aug 9, 2009
  8. 2/3 merge: fix incorrect merge message for ambiguous tag/branchJeff King, Aug 9, 2009
  9. 3/3 merge: indicate remote tracking branches in merge messageJeff King, Aug 9, 2009
  10. Jeff KingAug 9, 2009
  11. Junio C HamanoAug 9, 2009
  12. Jeff KingAug 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.