Subject: [PATCH 1/3] mailinfo.c: always collect the message-id

From: James Bottomley <[email-masked]>
Date: Thu, 16 Oct 2025 14:57:56 -0400

Prior to this mailinfo only collected the message-id if
add_messsage_id was true. Now git-am needs the message-id all the
time, hence the change, and anything checking to see if message-id
should be included in the trailer must check both any_message_id and
message_id.

Signed-off-by: James Bottomley <[email-masked]>
---
 mailinfo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mailinfo.c b/mailinfo.c
index 99ac596e09..62a30e37b1 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -609,8 +609,7 @@ static int check_header(struct mailinfo *mi,
 		goto check_header_out;
 	}
 	if (parse_header(line, "Message-ID", mi, &sb)) {
-		if (mi->add_message_id)
-			mi->message_id = strbuf_detach(&sb, NULL);
+		mi->message_id = strbuf_detach(&sb, NULL);
 		ret = 1;
 		goto check_header_out;
 	}
@@ -837,7 +836,7 @@ static int handle_commit_msg(struct mailinfo *mi, struct strbuf *line)
 	}
 
 	if (patchbreak(line)) {
-		if (mi->message_id)
+		if (mi->add_message_id && mi->message_id)
 			strbuf_addf(&mi->log_message,
 				    "Message-ID: %s\n", mi->message_id);
 		return 1;
-- 
2.51.0