diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-10-30 01:09:58 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-30 01:09:59 +0300 |
commit | 5006bfc1f5c4bf231d6ec9221d70b41a02d6e937 (patch) | |
tree | d5b548169ebd131b11d74de7e6bb767e367e0e3c /t/t9001-send-email.sh | |
parent | 90c80966571f9aae613c24ce731463a27728bdd3 (diff) | |
parent | 3ec6167567d0e1e03a728a64efa9848310d172ab (diff) |
Merge branch 'jk/send-email-fix-addresses-from-composed-messages'
The codepath to handle recipient addresses `git send-email
--compose` learns from the user was completely broken, which has
been corrected.
* jk/send-email-fix-addresses-from-composed-messages:
send-email: handle to/cc/bcc from --compose message
Revert "send-email: extract email-parsing code into a subroutine"
doc/send-email: mention handling of "reply-to" with --compose
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-x | t/t9001-send-email.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 263db3ad17..2e8e8137fb 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -2505,4 +2505,45 @@ test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' ' HEAD^ ' +test_expect_success $PREREQ '--compose handles lowercase headers' ' + write_script fake-editor <<-\EOF && + sed "s/^From:.*/from: edited-from@example.com/i" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + clean_fake_sendmail && + git send-email \ + --compose \ + --from="Example <from@example.com>" \ + --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + HEAD^ && + grep "From: edited-from@example.com" msgtxt1 +' + +test_expect_success $PREREQ '--compose handles to headers' ' + write_script fake-editor <<-\EOF && + sed "s/^To: .*/&, edited-to@example.com/" <"$1" >"$1.tmp" && + echo this is the body >>"$1.tmp" && + mv "$1.tmp" "$1" + EOF + clean_fake_sendmail && + GIT_SEND_EMAIL_NOTTY=1 \ + git send-email \ + --compose \ + --from="Example <from@example.com>" \ + --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + HEAD^ && + # Check both that the cover letter used our modified "to" line, + # but also that it was picked up for the patch. + q_to_tab >expect <<-\EOF && + To: nobody@example.com, + Qedited-to@example.com + EOF + grep -A1 "^To:" msgtxt1 >msgtxt1.to && + test_cmp expect msgtxt1.to && + grep -A1 "^To:" msgtxt2 >msgtxt2.to && + test_cmp expect msgtxt2.to +' + test_done |