diff mbox series

[v2,2/2] send-email: honor transferencoding config option again

Message ID 20190508105607.178244-3-gitster@pobox.com (mailing list archive)
State New, archived
Headers show
Series send-email: set xfer encoding correctly | expand

Commit Message

Junio C Hamano May 8, 2019, 10:56 a.m. UTC
Since e67a228cd8a ("send-email: automatically determine
transfer-encoding"), the value of sendmail.transferencoding in the
configuration file is ignored, because $target_xfer_encoding is
already defined read_config sub parses the configuration file.

Instead of initializing variable $target_xfer_encoding to 'auto' on
definition, we have to set it to the default value of 'auto' if is
undefined after calling read_config() twice to parsing the
configuration files for "sendemail.transferencoding" and
"sendemail.$ident.transferencoding".

It was made trivial to do so by the previous change.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-send-email.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eric Sunshine May 8, 2019, 9:24 p.m. UTC | #1
On Wed, May 8, 2019 at 6:56 AM Junio C Hamano <gitster@pobox.com> wrote:
> Since e67a228cd8a ("send-email: automatically determine
> transfer-encoding"), the value of sendmail.transferencoding in the
> configuration file is ignored, because $target_xfer_encoding is

s/,//

> already defined read_config sub parses the configuration file.

s/defined/& when/ --or -- s/defined/& by the time/

> Instead of initializing variable $target_xfer_encoding to 'auto' on
> definition, we have to set it to the default value of 'auto' if is

s/if is/if it is/

> undefined after calling read_config() twice to parsing the

s/parsing/parse/

> configuration files for "sendemail.transferencoding" and

s/files/file/ (I think)

> "sendemail.$ident.transferencoding".
>
> It was made trivial to do so by the previous change.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson May 8, 2019, 11:12 p.m. UTC | #2
On Wed, May 08, 2019 at 07:56:07PM +0900, Junio C Hamano wrote:
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 98bc295c6e..b9dd775b63 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -231,7 +231,7 @@ sub do_edit {
>  my (@suppress_cc);
>  my ($auto_8bit_encoding);
>  my ($compose_encoding);
> -my $target_xfer_encoding = 'auto';
> +my ($target_xfer_encoding);
>  
>  my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
>  
> @@ -271,7 +271,7 @@ sub do_edit {
>      "from" => [\$sender],
>      "assume8bitencoding" => [\$auto_8bit_encoding],
>      "composeencoding" => [\$compose_encoding],
> -    "transferencoding" => [\$target_xfer_encoding],
> +    "transferencoding" => [\$target_xfer_encoding, 'auto'],
>  );

These changes seem sane and the series makes the second one
straightforward. It's also a nice way to add defaults in the future, so
thanks for that.
Junio C Hamano May 9, 2019, 6:47 a.m. UTC | #3
Eric Sunshine <sunshine@sunshineco.com> writes:

> On Wed, May 8, 2019 at 6:56 AM Junio C Hamano <gitster@pobox.com> wrote:
>> Since e67a228cd8a ("send-email: automatically determine
>> transfer-encoding"), the value of sendmail.transferencoding in the
>> configuration file is ignored, because $target_xfer_encoding is
>
> s/,//

(also all other typofixes are obviously correct)

Thanks.
diff mbox series

Patch

diff --git a/git-send-email.perl b/git-send-email.perl
index 98bc295c6e..b9dd775b63 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -231,7 +231,7 @@  sub do_edit {
 my (@suppress_cc);
 my ($auto_8bit_encoding);
 my ($compose_encoding);
-my $target_xfer_encoding = 'auto';
+my ($target_xfer_encoding);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -271,7 +271,7 @@  sub do_edit {
     "from" => [\$sender],
     "assume8bitencoding" => [\$auto_8bit_encoding],
     "composeencoding" => [\$compose_encoding],
-    "transferencoding" => [\$target_xfer_encoding],
+    "transferencoding" => [\$target_xfer_encoding, 'auto'],
 );
 
 my %config_path_settings = (