summaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-10-26 22:02:03 -0700
committerJunio C Hamano <gitster@pobox.com>2010-10-26 22:02:03 -0700
commit8796ff7f3f3de6af48dc38b621f879d95f609bf7 (patch)
tree3376be2540ec846a434653f4789fa67cfc9969c4 /t/t9001-send-email.sh
parent9b73ce74e6abfb45626bce7a21465e6db6302be0 (diff)
parent3c3bb51c3b205a6838b022896c9323d4b25bf392 (diff)
downloadgit-8796ff7f3f3de6af48dc38b621f879d95f609bf7.tar.gz
Merge branch 'sb/send-email-use-to-from-input'
* sb/send-email-use-to-from-input: send-email: Don't leak To: headers between patches send-email: Use To: headers in patch files Conflicts: git-send-email.perl
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index ba11c00c74..028758c652 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -965,6 +965,45 @@ test_expect_success $PREREQ '--no-bcc overrides sendemail.bcc' '
! grep "RCPT TO:<other@ex.com>" stdout
'
+test_expect_success $PREREQ 'patches To headers are used by default' '
+ patch=`git format-patch -1 --to="bodies@example.com"` &&
+ test_when_finished "rm $patch" &&
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --smtp-server relay.example.com \
+ $patch >stdout &&
+ grep "RCPT TO:<bodies@example.com>" stdout
+'
+
+test_expect_success $PREREQ 'patches To headers are appended to' '
+ patch=`git format-patch -1 --to="bodies@example.com"` &&
+ test_when_finished "rm $patch" &&
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server relay.example.com \
+ $patch >stdout &&
+ grep "RCPT TO:<bodies@example.com>" stdout &&
+ grep "RCPT TO:<nobody@example.com>" stdout
+'
+
+test_expect_success $PREREQ 'To headers from files reset each patch' '
+ patch1=`git format-patch -1 --to="bodies@example.com"` &&
+ patch2=`git format-patch -1 --to="other@example.com" HEAD~` &&
+ test_when_finished "rm $patch1 && rm $patch2" &&
+ git send-email \
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --to="nobody@example.com" \
+ --smtp-server relay.example.com \
+ $patch1 $patch2 >stdout &&
+ test $(grep -c "RCPT TO:<bodies@example.com>" stdout) = 1 &&
+ test $(grep -c "RCPT TO:<nobody@example.com>" stdout) = 2 &&
+ test $(grep -c "RCPT TO:<other@example.com>" stdout) = 1
+'
+
test_expect_success $PREREQ 'setup expect' '
cat >email-using-8bit <<EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001