Skip to content

Commit 54aae5e

Browse files
committed
t9001: send-email interation with --in-reply-to and --chain-reply-to
1. When --in-reply-to gives $reply_to, the first one becomes a reply to that message, with or without --chain-reply-to. 2. When --chain-reply-to is in effect, all the messages are strung together to form a single chain. The first message may be in reply to the $reply_to given by --in-reply-to command line option (see previous), or the root of the discussion thread. The second one is a response to the first one, and the third one is a response to the second one, etc. 3. When --chain-reply-to is not in effect: a. When --in-reply-to is used, too, the second and the subsequent ones become replies to $reply_to. Together with the first rule, all messages become replies to $reply_to given by --in-reply-to. b. When --in-reply-to is not used, presumably the second and subsequent ones become replies to the first one, which would be the root. The documentation is reasonably clear about the 1., 2. and 3a. above, I think, even though I do not think 3b. is clearly specified. The two tests added by this patch at least documents what happens between these two options. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3089c2b commit 54aae5e

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

t/t9001-send-email.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,47 @@ 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+
# All the messages are replies to --in-reply-to
328+
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
329+
test_cmp expect actual &&
330+
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
331+
test_cmp expect actual &&
332+
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
333+
test_cmp expect actual
334+
'
335+
336+
test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
337+
clean_fake_sendmail &&
338+
echo "<unique-message-id@example.com>" >expect &&
339+
git send-email \
340+
--from="Example <nobody@example.com>" \
341+
--to=nobody@example.com \
342+
--chain-reply-to \
343+
--in-reply-to="$(cat expect)" \
344+
--smtp-server="$(pwd)/fake.sendmail" \
345+
$patches $patches $patches \
346+
2>errors &&
347+
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
348+
test_cmp expect actual &&
349+
sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
350+
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
351+
test_cmp expect actual &&
352+
sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
353+
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
354+
test_cmp expect actual
355+
'
356+
316357
test_expect_success $PREREQ 'setup fake editor' '
317358
(echo "#!$SHELL_PATH" &&
318359
echo "echo fake edit >>\"\$1\""

0 commit comments

Comments
 (0)