summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:25 (GMT)
commit5983ddc165221c3ec2a4299b65cfb2ecc1ce7765 (patch)
treef8ac350fed66a1d195487819d971264e48779c66
parentf1c9f6ce38445c7cba7dd5b2a8c329c8fff90993 (diff)
parent74d76a17013411d72ebda7c230b9898f3adb1fcc (diff)
downloadgit-5983ddc165221c3ec2a4299b65cfb2ecc1ce7765.zip
git-5983ddc165221c3ec2a4299b65cfb2ecc1ce7765.tar.gz
git-5983ddc165221c3ec2a4299b65cfb2ecc1ce7765.tar.bz2
Merge branch 'bc/send-email-qp-cr'
"git send-email" has been taught to use quoted-printable when the payload contains carriage-return. The use of the mechanism is in line with the design originally added the codepath that chooses QP when the payload has overly long lines. * bc/send-email-qp-cr: send-email: default to quoted-printable when CR is present
-rwxr-xr-xgit-send-email.perl2
-rwxr-xr-xt/t9001-send-email.sh14
2 files changed, 15 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 8200d58..751cabf 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1872,7 +1872,7 @@ sub apply_transfer_encoding {
$message = MIME::Base64::decode($message)
if ($from eq 'base64');
- $to = ($message =~ /.{999,}/) ? 'quoted-printable' : '8bit'
+ $to = ($message =~ /(?:.{999,}|\r)/) ? 'quoted-printable' : '8bit'
if $to eq 'auto';
die __("cannot send message as 7bit")
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index ee1efcc..1e3ac3c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -481,6 +481,20 @@ test_expect_success $PREREQ 'long lines with auto encoding are quoted-printable'
grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
'
+test_expect_success $PREREQ 'carriage returns with auto encoding are quoted-printable' '
+ clean_fake_sendmail &&
+ cp $patches cr.patch &&
+ printf "this is a line\r\n" >>cr.patch &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ --transfer-encoding=auto \
+ --no-validate \
+ cr.patch &&
+ grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
+'
+
for enc in auto quoted-printable base64
do
test_expect_success $PREREQ "--validate passes with encoding $enc" '