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

[PATCH 3/3] t4150-am: add a test for message-id header collection

From
James Bottomley <james.bottomley@hansenpartnership.com>
Date
Oct 16, 2025, 18:57 UTC
Message-ID
<20251016185758.21996-4-James.Bottomley@HansenPartnership.com>
In-Reply-To
<20251016185758.21996-1-James.Bottomley@HansenPartnership.com>

Since git am now always adds the message-id header, fix test 'am applies patch e-mail not in a mbox' not to add the header because otherwise the commit won't be equivalent to second and add a new test that the message-id header gets correctly added.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 t/t4150-am.sh | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 699a81ab5c..82603b2bbf 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -109,6 +109,12 @@ test_expect_success setup '
 		echo "X-Fake-Field: Line Three" &&
 		git format-patch --stdout first | sed -e "1d"
 	} > patch1.eml &&
+	{
+		echo "X-Fake-Field: Line One" &&
+		echo "X-Fake-Field: Line Two" &&
+		echo "X-Fake-Field: Line Three" &&
+		git format-patch --stdout first | sed -e "1d"
+	} > patch1-nomsgid.eml &&
 	{
 		echo "X-Fake-Field: Line One" &&
 		echo "X-Fake-Field: Line Two" &&
@@ -235,13 +241,25 @@ test_expect_success 'am applies patch e-mail not in a mbox' '
 	rm -fr .git/rebase-apply &&
 	git reset --hard &&
 	git checkout first &&
-	git am patch1.eml &&
+	git am patch1-nomsgid.eml &&
 	test_path_is_missing .git/rebase-apply &&
 	git diff --exit-code second &&
 	test "$(git rev-parse second)" = "$(git rev-parse HEAD)" &&
 	test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
 '
 
+test_expect_success 'am adds message-id to the header' '
+	rm -fr .git/rebase-apply &&
+	git reset --hard &&
+	git checkout first &&
+	git am patch1.eml &&
+	test_path_is_missing .git/rebase-apply &&
+	git diff --exit-code second &&
+	test "$(git rev-parse second)" != "$(git rev-parse HEAD)" &&
+	test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)" &&
+	git show --pretty=raw HEAD | grep "^message-id <1226501681-24923-1-git-send-email-bda@mnsspb.ru>"
+'
+
 test_expect_success 'am applies patch e-mail not in a mbox with CRLF' '
 	rm -fr .git/rebase-apply &&
 	git reset --hard &&
-- 
2.51.0
Previous: brian m. carlsonNext: Kristoffer Haugsbakk
Message 5 of 14 in “add a message-id header to git”
  1. 0/3 add a message-id header to gitJames Bottomley, Oct 16, 2025
  2. 1/3 mailinfo.c: always collect the message-idJames Bottomley, Oct 16, 2025
  3. 2/3 builtin/am.c: add a message-id commit headerJames Bottomley, Oct 16, 2025
  4. brian m. carlsonOct 16, 2025
  5. 3/3 t4150-am: add a test for message-id header collectionJames Bottomley, Oct 16, 2025
  6. Kristoffer HaugsbakkOct 16, 2025
  7. James BottomleyOct 16, 2025
  8. Kristoffer HaugsbakkOct 16, 2025
  9. Junio C HamanoOct 16, 2025
  10. James BottomleyOct 16, 2025
  11. Junio C HamanoOct 16, 2025
  12. Kristoffer HaugsbakkOct 16, 2025
  13. Kristoffer HaugsbakkOct 16, 2025
  14. Junio C HamanoOct 16, 2025

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.