summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2009-06-08 23:34:12 +0200
committerJunio C Hamano <gitster@pobox.com>2010-09-08 09:11:15 -0700
commita03bc5b6ad4ada4eb0669289429a9bc21ff6cdb0 (patch)
tree15903482a90fc4f8a1e773c491d995f223b8ee23 /t
parent04df568be53c42d07aea393effc7c5653f245d9a (diff)
downloadgit-a03bc5b6ad4ada4eb0669289429a9bc21ff6cdb0.tar.gz
send-email: Refuse to send cover-letter template subject
Every so often, someone sends out an unedited cover-letter template. Add a simple check to send-email that refuses to send if the subject contains "*** SUBJECT HERE ***", with an option --force to override. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-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 23597cc407..f3aedb9176 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -995,4 +995,40 @@ test_expect_success '--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