diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-03-15 00:58:55 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-15 00:58:55 -0700 |
commit | c24138bc55bcbbde2ea8601c504752e5a39f53f2 (patch) | |
tree | f3365ddde0f0fb8ea865bd2e9e8406147d2242ce /t | |
parent | Merge branch 'tc/http-cleanup' (diff) | |
parent | send-email: add --no-cc, --no-to, and --no-bcc (diff) | |
download | tgif-c24138bc55bcbbde2ea8601c504752e5a39f53f2.tar.xz |
Merge branch 'sd/format-patch-to'
* sd/format-patch-to:
send-email: add --no-cc, --no-to, and --no-bcc
format-patch: add --no-cc, --no-to, and --no-add-headers
format-patch: use a string_list for headers
Add 'git format-patch --to=' option and 'format.to' configuration variable.
Diffstat (limited to 't')
-rwxr-xr-x | t/t4014-format-patch.sh | 52 | ||||
-rwxr-xr-x | t/t9001-send-email.sh | 66 |
2 files changed, 118 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index f2a2aaa2b9..c7b625642d 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -143,6 +143,58 @@ test_expect_success 'configuration headers and command line headers' ' grep "^ *S. E. Cipient <scipient@example.com>\$" patch7 ' +test_expect_success 'command line To: header' ' + + git config --unset-all format.headers && + git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 && + grep "^To: R. E. Cipient <rcipient@example.com>\$" patch8 +' + +test_expect_success 'configuration To: header' ' + + git config format.to "R. E. Cipient <rcipient@example.com>" && + git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 && + grep "^To: R. E. Cipient <rcipient@example.com>\$" patch9 +' + +test_expect_success '--no-to overrides config.to' ' + + git config --replace-all format.to \ + "R. E. Cipient <rcipient@example.com>" && + git format-patch --no-to --stdout master..side | + sed -e "/^\$/q" >patch10 && + ! grep "^To: R. E. Cipient <rcipient@example.com>\$" patch10 +' + +test_expect_success '--no-to and --to replaces config.to' ' + + git config --replace-all format.to \ + "Someone <someone@out.there>" && + git format-patch --no-to --to="Someone Else <else@out.there>" \ + --stdout master..side | + sed -e "/^\$/q" >patch11 && + ! grep "^To: Someone <someone@out.there>\$" patch11 && + grep "^To: Someone Else <else@out.there>\$" patch11 +' + +test_expect_success '--no-cc overrides config.cc' ' + + git config --replace-all format.cc \ + "C. E. Cipient <rcipient@example.com>" && + git format-patch --no-cc --stdout master..side | + sed -e "/^\$/q" >patch12 && + ! grep "^Cc: C. E. Cipient <rcipient@example.com>\$" patch12 +' + +test_expect_success '--no-add-headers overrides config.headers' ' + + git config --replace-all format.headers \ + "Header1: B. E. Cipient <rcipient@example.com>" && + git format-patch --no-add-headers --stdout master..side | + sed -e "/^\$/q" >patch13 && + ! grep "^Header1: B. E. Cipient <rcipient@example.com>\$" patch13 +' + test_expect_success 'multiple files' ' rm -rf patches/ && diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index c09f375288..640b3d2bb4 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 |