summaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2010-10-04 07:05:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-10-04 07:12:13 (GMT)
commit3c3bb51c3b205a6838b022896c9323d4b25bf392 (patch)
tree03eb8b996e1d3f851843139d20c33c7921adfa9b /t/t9001-send-email.sh
parent21802cd32805b19fa32e8e3594ee3914733d53d3 (diff)
downloadgit-3c3bb51c3b205a6838b022896c9323d4b25bf392.zip
git-3c3bb51c3b205a6838b022896c9323d4b25bf392.tar.gz
git-3c3bb51c3b205a6838b022896c9323d4b25bf392.tar.bz2
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 <viresh.kumar@st.com> Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 294e31f..13d8d1a 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:<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