[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCHv4 6/6] git-send-email: use git credential to obtain password
From:       Junio C Hamano <gitster () pobox ! com>
Date:       2013-02-27 16:29:26
Message-ID: 7va9qpk9eh.fsf () alter ! siamese ! dyndns ! org
[Download RAW message or body]

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> diff --git a/git-send-email.perl b/git-send-email.perl
>> index 76bbfc3..c3501d9 100755
>> --- a/git-send-email.perl
>> +++ b/git-send-email.perl
>> @@ -1045,6 +1045,14 @@ sub maildomain {
>>  	return maildomain_net() || maildomain_mta() || 'localhost.localdomain';
>>  }
>>  
>> +sub smtp_host_string {
>> +	if (defined $smtp_server_port) {
>> +		return "$smtp_server:$smtp_server_port";
>> +	} else {
>> +		return $smtp_server;
>> +	}
>> +}
>> +
>>  # Returns 1 if authentication succeeded or was not necessary
>>  # (smtp_user was not specified), and 0 otherwise.
>>  
>> @@ -1065,7 +1073,7 @@ sub smtp_auth_maybe {
>>  	# reject credentials.
>>  	$auth = Git::credential({
>>  		'protocol' => 'smtp',
>> -		'host' => join(':', $smtp_server, $smtp_server_port),
>> +		'host' => smtp_host_string(),
>>  		'username' => $smtp_authuser,
>>  		# if there's no password, "git credential fill" will
>>  		# give us one, otherwise it'll just pass this one.
>> @@ -1188,9 +1196,7 @@ sub send_message {
>>  		else {
>>  			require Net::SMTP;
>>  			$smtp_domain ||= maildomain();
>> -			$smtp ||= Net::SMTP->new((defined $smtp_server_port)
>> -						 ? "$smtp_server:$smtp_server_port"
>> -						 : $smtp_server,
>> +			$smtp ||= Net::SMTP->new(smtp_host_string(),
>>  						 Hello => $smtp_domain,
>>  						 Debug => $debug_net_smtp);
>>  			if ($smtp_encryption eq 'tls' && $smtp) {
>
> Seems obviously correct. I also did a basic test and it worked smoothly.

OK, I'll squash it in.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic