git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] send-email: report host and port separately when calling git credential
@ 2018-03-31 18:05 Michal Nazarewicz
  2018-04-02 22:05 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Nazarewicz @ 2018-03-31 18:05 UTC (permalink / raw)
  To: gitster, git; +Cc: Michał Nazarewicz

When git-send-email uses git-credential to get SMTP password, it will
communicate SMTP host and port (if both are provided) as a single entry
‘host=<host>:<port>’.  This trips the ‘git-credential-store’ helper
which expects those values as separate keys (‘host’ and ‘port’).

Send the values as separate pieces of information so things work
smoothly.

Signed-off-by: Michał Nazarewicz <mina86@mina86.com>
---
 git-send-email.perl | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 2fa7818ca..2a9f89a58 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1229,14 +1229,6 @@ 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.
 
@@ -1263,7 +1255,8 @@ sub smtp_auth_maybe {
 	# reject credentials.
 	$auth = Git::credential({
 		'protocol' => 'smtp',
-		'host' => smtp_host_string(),
+		'host' => $smtp_server,
+		'port' => $smtp_server_port,
 		'username' => $smtp_authuser,
 		# if there's no password, "git credential fill" will
 		# give us one, otherwise it'll just pass this one.
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-07 10:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-31 18:05 [PATCH] send-email: report host and port separately when calling git credential Michal Nazarewicz
2018-04-02 22:05 ` Junio C Hamano
2018-04-02 23:23   ` [PATCH] send-email: fix docs regarding storing password with " Michal Nazarewicz
2018-04-04 21:14     ` Jeff King
2018-04-07 10:07       ` [PATCH] send-email: simplify Gmail example in the documentation Michal Nazarewicz
2018-04-07 10:08       ` [PATCH] send-email: fix docs regarding storing password with git credential Michał Nazarewicz
2018-04-04 21:07   ` [PATCH] send-email: report host and port separately when calling " Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).