aboutsummaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-01-07 13:07:27 -0800
committerJunio C Hamano <gitster@pobox.com>2015-01-07 13:07:27 -0800
commit5095fa61e38c92cbc8c603880f04f0d6127ae72e (patch)
tree30a2f235d0e73ee3c7e1dac76b1c3d20c30923a0 /t/t9001-send-email.sh
parent948e81408d29be0d39b55d5da41a6c7c9b93fbc0 (diff)
parent2cf770f50185fc7a1e3aaa0463eb452d32517f83 (diff)
downloadgit-5095fa61e38c92cbc8c603880f04f0d6127ae72e.tar.gz
git-5095fa61e38c92cbc8c603880f04f0d6127ae72e.tar.xz
Merge branch 'lh/send-email-hide-x-mailer'
"git send-email" normally identifies itself via X-Mailer: header in the message it sends out. A new command line flag allows the user to squelch the header. * lh/send-email-hide-x-mailer: test/send-email: --[no-]xmailer tests send-email: add --[no-]xmailer option
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index a8773bdf3..af6a3e890 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1564,4 +1564,37 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
grep "^!someone@example\.org!$" commandline1
'
+do_xmailer_test () {
+ expected=$1 params=$2 &&
+ git format-patch -1 &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=someone@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $params \
+ 0001-*.patch \
+ 2>errors >out &&
+ { grep '^X-Mailer:' out || :; } >mailer &&
+ test_line_count = $expected mailer
+}
+
+test_expect_success $PREREQ '--[no-]xmailer without any configuration' '
+ do_xmailer_test 1 "--xmailer" &&
+ do_xmailer_test 0 "--no-xmailer"
+'
+
+test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=true' '
+ test_config sendemail.xmailer true &&
+ do_xmailer_test 1 "" &&
+ do_xmailer_test 0 "--no-xmailer" &&
+ do_xmailer_test 1 "--xmailer"
+'
+
+test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
+ test_config sendemail.xmailer false &&
+ do_xmailer_test 0 "" &&
+ do_xmailer_test 0 "--no-xmailer" &&
+ do_xmailer_test 1 "--xmailer"
+'
+
test_done