From 3c3bb51c3b205a6838b022896c9323d4b25bf392 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Mon, 4 Oct 2010 00:05:24 -0700 Subject: send-email: Don't leak To: headers between patches If the first patch in a series has a To: header in the file and the second patch in the series doesn't the address from the first patch will be part of the To: addresses in the second patch. Fix this by treating the to list like the cc list. Have an initial to list come from the command line, user input and config options. Then build up a to list from each patch and concatenate the two together before sending the patch. Finally, reset the list after sending each patch so the To: headers from a patch don't get used for the next one. Reported-by: Viresh Kumar Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't/t9001-send-email.sh') diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 294e31f7f0..13d8d1a8b4 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -971,6 +971,21 @@ test_expect_success $PREREQ 'patches To headers are appended to' ' grep "RCPT TO:" 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 " \ + --to="nobody@example.com" \ + --smtp-server relay.example.com \ + $patch1 $patch2 >stdout && + test $(grep -c "RCPT TO:" stdout) = 1 && + test $(grep -c "RCPT TO:" stdout) = 2 && + test $(grep -c "RCPT TO:" stdout) = 1 +' + test_expect_success $PREREQ 'setup expect' ' cat >email-using-8bit <