X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft9001-send-email.sh;h=5e48318013a5bf0e4c0ab80f2e5cad6d96887e6a;hb=f3f973a0176d5fe7870ca4f27085d347b96307d2;hp=ba11c00c74468f996ba718b2c07dd1852c21d30d;hpb=329351feeb0c08c835ac4ff05f127fbfe42a78cf;p=git.git diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index ba11c00c7..5e4831801 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -222,7 +222,7 @@ test_expect_success $PREREQ 'tocmd works' ' test_expect_success $PREREQ 'cccmd works' ' clean_fake_sendmail && cp $patches cccmd.patch && - echo cccmd--cccmd@example.com >>cccmd.patch && + echo "cccmd-- cccmd@example.com" >>cccmd.patch && { echo "#!$SHELL_PATH" echo sed -n -e s/^cccmd--//p \"\$1\" @@ -313,6 +313,49 @@ 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 && + # The first message is a reply to --in-reply-to + sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual && + test_cmp expect actual && + # Second and subsequent messages are replies to the first one + 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/^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\"" @@ -965,6 +1008,45 @@ test_expect_success $PREREQ '--no-bcc overrides sendemail.bcc' ' ! grep "RCPT TO:" stdout ' +test_expect_success $PREREQ 'patches To headers are used by default' ' + patch=`git format-patch -1 --to="bodies@example.com"` && + test_when_finished "rm $patch" && + git send-email \ + --dry-run \ + --from="Example " \ + --smtp-server relay.example.com \ + $patch >stdout && + grep "RCPT TO:" stdout +' + +test_expect_success $PREREQ 'patches To headers are appended to' ' + patch=`git format-patch -1 --to="bodies@example.com"` && + test_when_finished "rm $patch" && + git send-email \ + --dry-run \ + --from="Example " \ + --to=nobody@example.com \ + --smtp-server relay.example.com \ + $patch >stdout && + grep "RCPT TO:" stdout && + grep "RCPT TO:" stdout +' + +test_expect_success $PREREQ 'To headers from files reset each patch' ' + patch1=`git format-patch -1 --to="bodies@example.com"` && + patch2=`git format-patch -1 --to="other@example.com" HEAD~` && + test_when_finished "rm $patch1 && rm $patch2" && + git send-email \ + --dry-run \ + --from="Example " \ + --to="nobody@example.com" \ + --smtp-server relay.example.com \ + $patch1 $patch2 >stdout && + test $(grep -c "RCPT TO:" stdout) = 1 && + test $(grep -c "RCPT TO:" stdout) = 2 && + test $(grep -c "RCPT TO:" stdout) = 1 +' + test_expect_success $PREREQ 'setup expect' ' cat >email-using-8bit <