diff options
-rw-r--r-- | Documentation/git-send-email.txt | 3 | ||||
-rwxr-xr-x | git-send-email.perl | 18 | ||||
-rwxr-xr-x | t/t9001-send-email.sh | 21 |
3 files changed, 28 insertions, 14 deletions
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 0e648075bb..2f32dbf16d 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -147,8 +147,7 @@ Note that no attempts whatsoever are made to validate the encoding. otherwise. + Default is the value of the `sendemail.transferEncoding` configuration -value; if that is unspecified, git will use 8bit and not add a -Content-Transfer-Encoding header. +value; if that is unspecified, default to `auto`. --xmailer:: --no-xmailer:: diff --git a/git-send-email.perl b/git-send-email.perl index e6bcc55827..f4c07908d2 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -231,7 +231,7 @@ my ($validate, $confirm); my (@suppress_cc); my ($auto_8bit_encoding); my ($compose_encoding); -my ($target_xfer_encoding); +my $target_xfer_encoding = 'auto'; my ($debug_net_smtp) = 0; # Net::SMTP, see send_message() @@ -1737,17 +1737,11 @@ sub process_file { } } } - if (defined $target_xfer_encoding) { - $xfer_encoding = '8bit' if not defined $xfer_encoding; - ($message, $xfer_encoding) = apply_transfer_encoding( - $message, $xfer_encoding, $target_xfer_encoding); - } - if (defined $xfer_encoding) { - push @xh, "Content-Transfer-Encoding: $xfer_encoding"; - } - if (defined $xfer_encoding or $has_content_type) { - unshift @xh, 'MIME-Version: 1.0' unless $has_mime_version; - } + $xfer_encoding = '8bit' if not defined $xfer_encoding; + ($message, $xfer_encoding) = apply_transfer_encoding( + $message, $xfer_encoding, $target_xfer_encoding); + push @xh, "Content-Transfer-Encoding: $xfer_encoding"; + unshift @xh, 'MIME-Version: 1.0' unless $has_mime_version; $needs_confirm = ( $confirm eq "always" or diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 1b474cca28..1da282c415 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -225,6 +225,8 @@ X-Mailer: X-MAILER-STRING In-Reply-To: <unique-message-id@example.com> References: <unique-message-id@example.com> Reply-To: Reply <reply@example.com> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -415,6 +417,7 @@ test_expect_success $PREREQ 'reject long lines' ' --from="Example <nobody@example.com>" \ --to=nobody@example.com \ --smtp-server="$(pwd)/fake.sendmail" \ + --transfer-encoding=8bit \ $patches longline.patch \ 2>errors && grep longline.patch errors @@ -609,6 +612,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -653,6 +658,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -688,6 +695,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -714,6 +723,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -748,6 +759,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -779,6 +792,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -810,6 +825,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -845,6 +862,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF @@ -873,6 +892,8 @@ Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING X-Mailer: X-MAILER-STRING +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit Result: OK EOF |