summaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-07-24 00:44:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-07-24 01:00:34 (GMT)
commitdd84e528a34c3822e7ab0473a95e411665b37681 (patch)
tree92ec8f5e78e1aeac2be748dcf0262a370cc228cb /t/t9001-send-email.sh
parent3d20111cbd42c9ef3116bb629838bcbfea508cda (diff)
downloadgit-dd84e528a34c3822e7ab0473a95e411665b37681.zip
git-dd84e528a34c3822e7ab0473a95e411665b37681.tar.gz
git-dd84e528a34c3822e7ab0473a95e411665b37681.tar.bz2
git-send-email: die if sendmail.* config is set
I've seen several people mis-configure git send-email on their first attempt because they set the sendmail.* config options - not sendemail.*. This patch detects this mistake and bails out with a friendly warning. Signed-off-by: Drew DeVault <sir@cmpwn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index ec26108..897bc6a 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2142,4 +2142,33 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
"$(pwd)/0001-add-master.patch"
'
+test_expect_success $PREREQ 'test that sendmail config is rejected' '
+ test_config sendmail.program sendmail &&
+ test_must_fail git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ HEAD^ 2>err &&
+ test_i18ngrep "found configuration options for '"'"sendmail"'"'" err
+'
+
+test_expect_success $PREREQ 'test that sendmail config rejection is specific' '
+ test_config resendmail.program sendmail &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ HEAD^
+'
+
+test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' '
+ test_config sendmail.program sendmail &&
+ test_config sendemail.forbidSendmailVariables false &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ HEAD^
+'
+
test_done