lib-git-svn.sh: Move web-server handling code into separate function
[gitweb.git] / t / t9001-send-email.sh
index d1ba25205b86c3a4aeca16ec988e2ed2ecca1da2..3271426f795e7c3e1e424f4f17d96c2f27daa868 100755 (executable)
@@ -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 "<unique-message-id@example.com>" >expect &&
+       git send-email \
+               --from="Example <nobody@example.com>" \
+               --to=nobody@example.com \
+               --nochain-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 "<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\""
@@ -1092,7 +1135,7 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
 # Note that the patches in this test are deliberately out of order; we
 # want to make sure it works even if the cover-letter is not in the
 # first mail.
-test_expect_success 'refusing to send cover letter template' '
+test_expect_success $PREREQ 'refusing to send cover letter template' '
        clean_fake_sendmail &&
        rm -fr outdir &&
        git format-patch --cover-letter -2 -o outdir &&
@@ -1108,7 +1151,7 @@ test_expect_success 'refusing to send cover letter template' '
        test -z "$(ls msgtxt*)"
 '
 
-test_expect_success '--force sends cover letter template anyway' '
+test_expect_success $PREREQ '--force sends cover letter template anyway' '
        clean_fake_sendmail &&
        rm -fr outdir &&
        git format-patch --cover-letter -2 -o outdir &&