Subject: Re: [PATCH v3] send-email: Improve format of smtp initialization error message

From: Alex Kuleshov <[email-masked]>
Date: Tue, 30 Dec 2014 16:59:04 +0600

What's about output like this:

Unable to initialize SMTP properly. Check config and use --smtp-debug.

VALUES:
	server=smtp.gmail.com
	encryption=
	hello=localhost.localdomain
	port=587

Junio C Hamano <[email-masked]> @ 2014-12-30 00:50 QYZT:

> Alexander Kuleshov <[email-masked]> writes:
>
>> Signed-off-by: Alexander Kuleshov <[email-masked]>
>> ---
>>  git-send-email.perl | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/git-send-email.perl b/git-send-email.perl
>> index 82c6fea..60dcd8d 100755
>> --- a/git-send-email.perl
>> +++ b/git-send-email.perl
>> @@ -1275,10 +1275,10 @@ X-Mailer: git-send-email $gitversion
>>
>>  		if (!$smtp) {
>>  			die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
>> -			    "VALUES: server=$smtp_server ",
>> -			    "encryption=$smtp_encryption ",
>> -			    "hello=$smtp_domain",
>> -			    defined $smtp_server_port ? " port=$smtp_server_port" : "";
>> +			    "\nVALUES: \n\tserver=$smtp_server ",
>> +			    "\n\tencryption=$smtp_encryption ",
>> +			    "\n\thello=$smtp_domain",
>> +			    defined $smtp_server_port ? " \n\tport=$smtp_server_port" : "";
>
> It may be a good convention to have LF at the beginning of a new
> string (i.e. we terminate the old line only when we have something
> more to say), but that is true only when we want to end the sentence
> without the final newline.  I wonder if that is true in this case;
> do we want perl to say "at line # in file X" at the end?
>
> In any case, you have two output lines that ends with a trailing SP
> just before LF, which is probably not what you wanted.
>
> If we want to see all lines end with LF, it may be far easier to
> read this way:
>
> 	die "msg\n",
>             "\tvar1=val1\n",
>             "\tvar2=val2\n",
>             defined $var3 ? "\tvar3=val3\n" : "";
>
> I dunno.

--
Best regards.
0xAX