summaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-11-24 12:44:12 -0800
committerJunio C Hamano <gitster@pobox.com>2010-11-24 12:44:12 -0800
commit71d35bdb3613b753dbd5b83992e298531f701b6b (patch)
tree76ae8083434848a38048297eb5f9c03367c785b3 /t/t9001-send-email.sh
parent401857c4c641a73e7fb78d26a9c2ad6eb316b739 (diff)
parenta03bc5b6ad4ada4eb0669289429a9bc21ff6cdb0 (diff)
downloadgit-71d35bdb3613b753dbd5b83992e298531f701b6b.tar.gz
Merge branch 'tr/send-email-refuse-sending-unedited-cover-letter' into maint
* tr/send-email-refuse-sending-unedited-cover-letter: send-email: Refuse to send cover-letter template subject
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 07c50c764c..a298eb0437 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1032,4 +1032,40 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
test_cmp expected actual
'
+# 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' '
+ clean_fake_sendmail &&
+ rm -fr outdir &&
+ git format-patch --cover-letter -2 -o outdir &&
+ test_must_fail git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0002-*.patch \
+ outdir/0000-*.patch \
+ outdir/0001-*.patch \
+ 2>errors >out &&
+ grep "SUBJECT HERE" errors &&
+ test -z "$(ls msgtxt*)"
+'
+
+test_expect_success '--force sends cover letter template anyway' '
+ clean_fake_sendmail &&
+ rm -fr outdir &&
+ git format-patch --cover-letter -2 -o outdir &&
+ git send-email \
+ --force \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0002-*.patch \
+ outdir/0000-*.patch \
+ outdir/0001-*.patch \
+ 2>errors >out &&
+ ! grep "SUBJECT HERE" errors &&
+ test -n "$(ls msgtxt*)"
+'
+
test_done