{"thread":{"id":"49732","subject":"[PATCH] send-email: Avoid empty transfer encoding header","startedAt":"2018-11-02T01:17:38Z","lastAt":"2018-11-02T09:53:04Z","messageCount":3,"participants":["Aaron Lindsay","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"362221","messageId":"20181102010934.15473-1-aaron@aclindsay.com","threadId":"49732","inReplyTo":null,"subject":"[PATCH] send-email: Avoid empty transfer encoding header","fromName":"Aaron Lindsay","fromEmail":"aaron@aclindsay.com","sentAt":"2018-11-02T01:09:34Z","receivedAt":"2018-11-02T01:17:38Z","isPatch":true,"sender":{"key":"aaron@aclindsay.com","avatar":null},"body":"Fix a small bug introduced by \"7a36987ff (send-email: add an auto option\nfor transfer encoding, 2018-07-14)\n\nI saw the following message when setting --transfer-encoding for a file\nwith the same encoding:\n    $ git send-email --transfer-encoding=8bit example.patch\n    Use of uninitialized value $xfer_encoding in concatenation (.) or string\n    at /usr/lib/git-core/git-send-email line 1744.\n\nSigned-off-by: Aaron Lindsay <aaron@aclindsay.com>\n---\n git-send-email.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 2be5dac33..39c15bcc8 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1834,7 +1834,7 @@ sub apply_transfer_encoding {\n \tmy $from = shift;\n \tmy $to = shift;\n \n-\treturn $message if ($from eq $to and $from ne '7bit');\n+\treturn ($message, $to) if ($from eq $to and $from ne '7bit');\n \n \trequire MIME::QuotedPrint;\n \trequire MIME::Base64;\n-- \n2.19.1\n\n"},{"id":"362225","messageId":"20181102015335.GC731755@genre.crustytoothpaste.net","threadId":"49732","inReplyTo":"20181102010934.15473-1-aaron@aclindsay.com","subject":"Re: [PATCH] send-email: Avoid empty transfer encoding header","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-11-02T01:53:35Z","receivedAt":"2018-11-02T01:53:45Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Thu, Nov 01, 2018 at 09:09:34PM -0400, Aaron Lindsay wrote:\n> Fix a small bug introduced by \"7a36987ff (send-email: add an auto option\n> for transfer encoding, 2018-07-14)\n> \n> I saw the following message when setting --transfer-encoding for a file\n> with the same encoding:\n>     $ git send-email --transfer-encoding=8bit example.patch\n>     Use of uninitialized value $xfer_encoding in concatenation (.) or string\n>     at /usr/lib/git-core/git-send-email line 1744.\n> \n> Signed-off-by: Aaron Lindsay <aaron@aclindsay.com>\n> ---\n>  git-send-email.perl | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 2be5dac33..39c15bcc8 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1834,7 +1834,7 @@ sub apply_transfer_encoding {\n>  \tmy $from = shift;\n>  \tmy $to = shift;\n>  \n> -\treturn $message if ($from eq $to and $from ne '7bit');\n> +\treturn ($message, $to) if ($from eq $to and $from ne '7bit');\n\nThanks, this is obviously correct.\n\nWould you like to squash in the below patch to add a test?\n\n----- >% -----\nFrom 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001\nFrom: \"brian m. carlson\" <sandals@crustytoothpaste.net>\nDate: Fri, 2 Nov 2018 01:51:33 +0000\nSubject: [PATCH] squash! send-email: Avoid empty transfer encoding header\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9001-send-email.sh | 15 +++++++++++++++\n 1 file changed, 15 insertions(+)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 1ef1a19003..ee1efcc59d 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -492,6 +492,21 @@ do\n \t\t\t--validate \\\n \t\t\t$patches longline.patch\n \t'\n+\n+done\n+\n+for enc in 7bit 8bit quoted-printable base64\n+do\n+\ttest_expect_success $PREREQ \"--transfer-encoding=$enc produces correct header\" '\n+\t\tclean_fake_sendmail &&\n+\t\tgit send-email \\\n+\t\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t\t--to=nobody@example.com \\\n+\t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\t\t--transfer-encoding=$enc \\\n+\t\t\t$patches &&\n+\t\tgrep \"Content-Transfer-Encoding: $enc\" msgtxt1\n+\t'\n done\n \n test_expect_success $PREREQ 'Invalid In-Reply-To' '\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"362260","messageId":"20181102095238.25766-1-aaron@aclindsay.com","threadId":"49732","inReplyTo":"20181102015335.GC731755@genre.crustytoothpaste.net","subject":"[PATCH v2] send-email: Avoid empty transfer encoding header","fromName":"Aaron Lindsay","fromEmail":"aaron@aclindsay.com","sentAt":"2018-11-02T09:52:38Z","receivedAt":"2018-11-02T09:53:04Z","isPatch":true,"sender":{"key":"aaron@aclindsay.com","avatar":null},"body":"Fix a small bug introduced by \"7a36987ff (send-email: add an auto option\nfor transfer encoding, 2018-07-14)\"\n\nI saw the following message when setting --transfer-encoding for a file\nwith the same encoding:\n    $ git send-email --transfer-encoding=8bit example.patch\n    Use of uninitialized value $xfer_encoding in concatenation (.) or string\n    at /usr/lib/git-core/git-send-email line 1744.\n\nv2 adds a test provided by brian m. carlson.\n\nSigned-off-by: Aaron Lindsay <aaron@aclindsay.com>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n git-send-email.perl   |  2 +-\n t/t9001-send-email.sh | 15 +++++++++++++++\n 2 files changed, 16 insertions(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 2be5dac33..39c15bcc8 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1834,7 +1834,7 @@ sub apply_transfer_encoding {\n \tmy $from = shift;\n \tmy $to = shift;\n \n-\treturn $message if ($from eq $to and $from ne '7bit');\n+\treturn ($message, $to) if ($from eq $to and $from ne '7bit');\n \n \trequire MIME::QuotedPrint;\n \trequire MIME::Base64;\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 1ef1a1900..ee1efcc59 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -492,6 +492,21 @@ do\n \t\t\t--validate \\\n \t\t\t$patches longline.patch\n \t'\n+\n+done\n+\n+for enc in 7bit 8bit quoted-printable base64\n+do\n+\ttest_expect_success $PREREQ \"--transfer-encoding=$enc produces correct header\" '\n+\t\tclean_fake_sendmail &&\n+\t\tgit send-email \\\n+\t\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t\t--to=nobody@example.com \\\n+\t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\t\t--transfer-encoding=$enc \\\n+\t\t\t$patches &&\n+\t\tgrep \"Content-Transfer-Encoding: $enc\" msgtxt1\n+\t'\n done\n \n test_expect_success $PREREQ 'Invalid In-Reply-To' '\n-- \n2.19.1\n\n"}]}