Skip to content

Commit 3c88e46

Browse files
aclindsagitster
authored andcommitted
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 <[email protected]> Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fa29f36 commit 3c88e46

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

git-send-email.perl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ sub apply_transfer_encoding {
18351835
my $from = shift;
18361836
my $to = shift;
18371837

1838-
return $message if ($from eq $to and $from ne '7bit');
1838+
return ($message, $to) if ($from eq $to and $from ne '7bit');
18391839

18401840
require MIME::QuotedPrint;
18411841
require MIME::Base64;

t/t9001-send-email.sh

+15
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,21 @@ do
493493
--validate \
494494
$patches longline.patch
495495
'
496+
497+
done
498+
499+
for enc in 7bit 8bit quoted-printable base64
500+
do
501+
test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
502+
clean_fake_sendmail &&
503+
git send-email \
504+
--from="Example <[email protected]>" \
505+
506+
--smtp-server="$(pwd)/fake.sendmail" \
507+
--transfer-encoding=$enc \
508+
$patches &&
509+
grep "Content-Transfer-Encoding: $enc" msgtxt1
510+
'
496511
done
497512

498513
test_expect_success $PREREQ 'Invalid In-Reply-To' '

0 commit comments

Comments
 (0)