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

Re: git-merge adds test to a message -- bug?

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 24, 2008, 05:17 UTC
Message-ID
<7vabko3dm2.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<slrnfudp0q.19k.joerg@alea.gnuu.de>
Jörg Sommer <joerg@alea.gnuu.de> writes:
> is it correct, that this test fails?
Interesting.

The following patch will change the bahaviour to what your test script expects, but by looking at the original code, you can tell that it is indeed the intended behaviour of "-M' to _allow_ you to _prepend_ your own message to the standardized "Merge these" message, not _replace_ with it.

I unfortunately do not recall why _prepend_, and not _replace_, had to be the right behaviour. Unless somebody can point out there was a valid reason but that reason is not relevant anymore, I am reluctant to apply the patch below this late in the cycle.

 git-merge.sh |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/git-merge.sh b/git-merge.sh
index 7dbbb1d..a5ce649 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -250,17 +250,19 @@ else
 	# We are invoked directly as the first-class UI.
 	head_arg=HEAD
 
-	# All the rest are the commits being merged; prepare
-	# the standard merge summary message to be appended to
-	# the given message.  If remote is invalid we will die
-	# later in the common codepath so we discard the error
-	# in this loop.
-	merge_name=$(for remote
-		do
-			merge_name "$remote"
-		done | git fmt-merge-msg
-	)
-	merge_msg="${merge_msg:+$merge_msg$LF$LF}$merge_name"
+	if test -z "$merge_msg"
+	then
+		# All the rest are the commits being merged; prepare
+		# the standard merge summary message to be appended to
+		# the given message.  If remote is invalid we will die
+		# later in the common codepath so we discard the error
+		# in this loop.
+		merge_msg=$(for remote
+			do
+				merge_name "$remote"
+			done | git fmt-merge-msg
+		)
+	fi
 fi
 head=$(git rev-parse --verify "$head_arg"^0) || usage
 
Previous: Jörg SommerNext: Johannes Schindelin
Message 2 of 7 in “git-merge adds test to a message -- bug?”
  1. Jörg SommerMar 23, 2008
  2. Junio C HamanoMar 24, 2008
  3. Johannes SchindelinMar 24, 2008
  4. Junio C HamanoMar 24, 2008
  5. Jörg SommerMar 25, 2008
  6. Johannes SchindelinMar 25, 2008
  7. Jörg SommerApr 9, 2008

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.