From: James Bottomley <James.Bottomley@HansenPartnership•com>
To: git@vger•kernel.org
Subject: [PATCH 3/3] t4150-am: add a test for message-id header collection
Date: Thu, 16 Oct 2025 14:57:58 -0400 [thread overview]
Message-ID: <20251016185758.21996-4-James.Bottomley@HansenPartnership.com> (raw)
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
next prev parent reply other threads:[~2025-10-16 18:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 18:57 [PATCH 0/3] add a message-id header to git James Bottomley
2025-10-16 18:57 ` [PATCH 1/3] mailinfo.c: always collect the message-id James Bottomley
2025-10-16 18:57 ` [PATCH 2/3] builtin/am.c: add a message-id commit header James Bottomley
2025-10-16 22:41 ` brian m. carlson
2025-10-16 18:57 ` James Bottomley [this message]
2025-10-16 19:26 ` [PATCH 0/3] add a message-id header to git Kristoffer Haugsbakk
2025-10-16 20:10 ` James Bottomley
2025-10-16 20:31 ` Kristoffer Haugsbakk
2025-10-16 20:32 ` Junio C Hamano
2025-10-16 21:00 ` James Bottomley
2025-10-16 21:18 ` Junio C Hamano
2025-10-16 21:28 ` Kristoffer Haugsbakk
2025-10-16 21:50 ` Kristoffer Haugsbakk
2025-10-16 22:15 ` Junio C Hamano
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=20251016185758.21996-4-James.Bottomley@HansenPartnership.com \
--to=james.bottomley@hansenpartnership$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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