summaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2010-03-07 22:46:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-08 23:55:42 (GMT)
commitf434c083a097bdc43991e4b0282b9aa1a994a60e (patch)
treed0665e90ef88cae64ab7add20ce0b04a16a3412f /t/t9001-send-email.sh
parentc42600346bb6c3427df7ea1c5a33d723ec02d731 (diff)
downloadgit-f434c083a097bdc43991e4b0282b9aa1a994a60e.zip
git-f434c083a097bdc43991e4b0282b9aa1a994a60e.tar.gz
git-f434c083a097bdc43991e4b0282b9aa1a994a60e.tar.bz2
send-email: add --no-cc, --no-to, and --no-bcc
There's no way to override the sendemail.to, sendemail.cc, and sendemail.bcc config settings. Add options allowing the user to tell git to ignore the config settings and take whatever is on the command line. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c09f375..640b3d2 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -852,4 +852,70 @@ test_expect_success 'no warning with sendemail.chainreplyto = true' '
! grep "no-chain-reply-to" errors
'
+test_expect_success 'sendemail.to works' '
+ git config --replace-all sendemail.to "Somebody <somebody@ex.com>" &&
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ $patches $patches >stdout &&
+ grep "To: Somebody <somebody@ex.com>" stdout
+'
+
+test_expect_success '--no-to overrides sendemail.to' '
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --no-to \
+ --to=nobody@example.com \
+ $patches $patches >stdout &&
+ grep "To: nobody@example.com" stdout &&
+ ! grep "To: Somebody <somebody@ex.com>" stdout
+'
+
+test_expect_success 'sendemail.cc works' '
+ git config --replace-all sendemail.cc "Somebody <somebody@ex.com>" &&
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ $patches $patches >stdout &&
+ grep "Cc: Somebody <somebody@ex.com>" stdout
+'
+
+test_expect_success '--no-cc overrides sendemail.cc' '
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --no-cc \
+ --cc=bodies@example.com \
+ --to=nobody@example.com \
+ $patches $patches >stdout &&
+ grep "Cc: bodies@example.com" stdout &&
+ ! grep "Cc: Somebody <somebody@ex.com>" stdout
+'
+
+test_expect_success 'sendemail.bcc works' '
+ git config --replace-all sendemail.bcc "Other <other@ex.com>" &&
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server relay.example.com \
+ $patches $patches >stdout &&
+ grep "RCPT TO:<other@ex.com>" stdout
+'
+
+test_expect_success '--no-bcc overrides sendemail.bcc' '
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --no-bcc \
+ --bcc=bodies@example.com \
+ --to=nobody@example.com \
+ --smtp-server relay.example.com \
+ $patches $patches >stdout &&
+ grep "RCPT TO:<bodies@example.com>" stdout &&
+ ! grep "RCPT TO:<other@ex.com>" stdout
+'
+
test_done