From 54aae5e1a08cb8c788d6f7345ca29898a5941140 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 19 Oct 2010 11:46:31 -0700 Subject: 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 --- t/t9001-send-email.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 't/t9001-send-email.sh') diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index d1ba25205b..26c2e93c43 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -313,6 +313,47 @@ test_expect_success $PREREQ 'Valid In-Reply-To when prompting' ' ! grep "^In-Reply-To: < *>" msgtxt1 ' +test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' ' + clean_fake_sendmail && + echo "" >expect && + git send-email \ + --from="Example " \ + --to=nobody@example.com \ + --no-chain-reply-to \ + --in-reply-to="$(cat expect)" \ + --smtp-server="$(pwd)/fake.sendmail" \ + $patches $patches $patches \ + 2>errors && + # All the messages are replies to --in-reply-to + sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual && + test_cmp expect actual && + sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual && + test_cmp expect actual && + sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual && + test_cmp expect actual +' + +test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' ' + clean_fake_sendmail && + echo "" >expect && + git send-email \ + --from="Example " \ + --to=nobody@example.com \ + --chain-reply-to \ + --in-reply-to="$(cat expect)" \ + --smtp-server="$(pwd)/fake.sendmail" \ + $patches $patches $patches \ + 2>errors && + sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual && + test_cmp expect actual && + sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect && + sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual && + test_cmp expect actual && + sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect && + sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual && + test_cmp expect actual +' + test_expect_success $PREREQ 'setup fake editor' ' (echo "#!$SHELL_PATH" && echo "echo fake edit >>\"\$1\"" -- cgit v1.2.3