@@ -313,6 +313,49 @@ test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '
313313 ! grep "^In-Reply-To: < *>" msgtxt1
314314'
315315
316+ test_expect_success $PREREQ ' In-Reply-To without --chain-reply-to' '
317+ clean_fake_sendmail &&
318+ echo "<unique-message-id@example.com>" >expect &&
319+ git send-email \
320+ --from="Example <nobody@example.com>" \
321+ --to=nobody@example.com \
322+ --no-chain-reply-to \
323+ --in-reply-to="$(cat expect)" \
324+ --smtp-server="$(pwd)/fake.sendmail" \
325+ $patches $patches $patches \
326+ 2>errors &&
327+ # The first message is a reply to --in-reply-to
328+ sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
329+ test_cmp expect actual &&
330+ # Second and subsequent messages are replies to the first one
331+ sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
332+ sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
333+ test_cmp expect actual &&
334+ sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
335+ test_cmp expect actual
336+ '
337+
338+ test_expect_success $PREREQ ' In-Reply-To with --chain-reply-to' '
339+ clean_fake_sendmail &&
340+ echo "<unique-message-id@example.com>" >expect &&
341+ git send-email \
342+ --from="Example <nobody@example.com>" \
343+ --to=nobody@example.com \
344+ --chain-reply-to \
345+ --in-reply-to="$(cat expect)" \
346+ --smtp-server="$(pwd)/fake.sendmail" \
347+ $patches $patches $patches \
348+ 2>errors &&
349+ sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
350+ test_cmp expect actual &&
351+ sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
352+ sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
353+ test_cmp expect actual &&
354+ sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
355+ sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
356+ test_cmp expect actual
357+ '
358+
316359test_expect_success $PREREQ ' setup fake editor' '
317360 (echo "#!$SHELL_PATH" &&
318361 echo "echo fake edit >>\"\$1\""
0 commit comments