diff options
author | Aaron Lindsay <aaron@aclindsay.com> | 2018-11-02 09:52:38 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-02 14:59:53 (GMT) |
commit | 3c88e46f1a4328f594cbdcd6109034d9fb9a1b56 (patch) | |
tree | 373325f04bf76dee5fa8292c3963fb5c27fb8f68 | |
parent | fa29f36d990df8cd42f323847245ab2ae0f0ae62 (diff) | |
download | git-3c88e46f1a4328f594cbdcd6109034d9fb9a1b56.zip git-3c88e46f1a4328f594cbdcd6109034d9fb9a1b56.tar.gz git-3c88e46f1a4328f594cbdcd6109034d9fb9a1b56.tar.bz2 |
send-email: avoid empty transfer encoding header
Fix a small bug introduced by "7a36987ff (send-email: add an auto option
for transfer encoding, 2018-07-14)".
I saw the following message when setting --transfer-encoding for a file
with the same encoding:
$ git send-email --transfer-encoding=8bit example.patch
Use of uninitialized value $xfer_encoding in concatenation (.) or string
at /usr/lib/git-core/git-send-email line 1744.
The new tests are by brian m. carlson.
Signed-off-by: Aaron Lindsay <aaron@aclindsay.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | git-send-email.perl | 2 | ||||
-rwxr-xr-x | t/t9001-send-email.sh | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index f4c0790..6b5d746 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1835,7 +1835,7 @@ sub apply_transfer_encoding { my $from = shift; my $to = shift; - return $message if ($from eq $to and $from ne '7bit'); + return ($message, $to) if ($from eq $to and $from ne '7bit'); require MIME::QuotedPrint; require MIME::Base64; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 1da282c..8e36a67 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -493,6 +493,21 @@ do --validate \ $patches longline.patch ' + +done + +for enc in 7bit 8bit quoted-printable base64 +do + test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" ' + clean_fake_sendmail && + git send-email \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + --transfer-encoding=$enc \ + $patches && + grep "Content-Transfer-Encoding: $enc" msgtxt1 + ' done test_expect_success $PREREQ 'Invalid In-Reply-To' ' |