Merge branch 'sb/send-email-use-to-from-input' into next

* sb/send-email-use-to-from-input:
  send-email: Use To: headers in patch files
This commit is contained in:
Junio C Hamano
2010-09-30 15:00:02 -07:00
2 changed files with 31 additions and 0 deletions

View File

@@ -1194,6 +1194,13 @@ foreach my $t (@files) {
$1, $_) unless $quiet;
push @cc, $1;
}
elsif (/^To:\s+(.*)$/) {
foreach my $addr (parse_address_line($1)) {
printf("(mbox) Adding to: %s from line '%s'\n",
$addr, $_) unless $quiet;
push @to, sanitize_address($addr);
}
}
elsif (/^Cc:\s+(.*)$/) {
foreach my $addr (parse_address_line($1)) {
if (unquote_rfc2047($addr) eq $sender) {

View File

@@ -947,6 +947,30 @@ 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 'setup expect' '
cat >email-using-8bit <<EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001