summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-10-19 11:46:31 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-11-05 14:21:05 -0700
commit54aae5e1a08cb8c788d6f7345ca29898a5941140 (patch)
tree640c898878c6bb497e068b72a3052f65f4655037 /t
parentMerge branch 'aw/git-p4-deletion' (diff)
downloadtgif-54aae5e1a08cb8c788d6f7345ca29898a5941140.tar.xz
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>
Diffstat (limited to 't')
-rwxr-xr-xt/t9001-send-email.sh41
1 files changed, 41 insertions, 0 deletions
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 "<unique-message-id@example.com>" >expect &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --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 "<unique-message-id@example.com>" >expect &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --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\""