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

Re: [PATCH] git-commit: Allow to amend a merge commit that does not change the tree

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 3, 2007, 08:26 UTC
Message-ID
<7vir3gmbf6.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7vtzn0md0h.fsf@gitster.siamese.dyndns.org>
Will roll in this as a new test.
--
 t/t7501-commit.sh |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 31a6f63..2e7bcb0 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -244,4 +244,36 @@ test_expect_success 'multiple -m' '
 
 '
 
+test_expect_success 'same tree (single parent)' '
+
+	if git commit -m empty
+	then
+		echo oops -- should have complained
+		false
+	else
+		: happy
+	fi
+
+'
+
+test_expect_success 'same tree (merge and amend merge)' '
+
+	git checkout -b side HEAD^ &&
+	echo zero >zero &&
+	git add zero &&
+	git commit -m "add zero" &&
+	git checkout master &&
+
+	git merge -s ours side -m "empty ok" &&
+	git diff HEAD^ HEAD >actual &&
+	: >expected &&
+	diff -u expected actual &&
+
+	git commit --amend -m "empty really ok" &&
+	git diff HEAD^ HEAD >actual &&
+	: >expected &&
+	diff -u expected actual
+
+'
+
 test_done
-- 
1.5.3.7-2077-ga07a
Previous: Junio C Hamano
Message 3 of 3 in “git-commit: Allow to amend a merge commit that does not change the tree”
  1. git-commit: Allow to amend a merge commit that does not change the treeJohannes Sixt, Dec 3, 2007
  2. Junio C HamanoDec 3, 2007
  3. Junio C HamanoDec 3, 2007

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.