From 8dee150a302e98c26b92133a80d6b43e4cb31a87 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Mon, 12 Jun 2017 11:25:39 +0200 Subject: transport/git: ensure port is added to host parameter --- plumbing/transport/git/common.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'plumbing/transport') diff --git a/plumbing/transport/git/common.go b/plumbing/transport/git/common.go index 753f125..6776b69 100644 --- a/plumbing/transport/git/common.go +++ b/plumbing/transport/git/common.go @@ -90,7 +90,12 @@ func (c *command) StdoutPipe() (io.Reader, error) { } func endpointToCommand(cmd string, ep transport.Endpoint) string { - return fmt.Sprintf("%s %s%chost=%s%c", cmd, ep.Path(), 0, ep.Host(), 0) + host := ep.Host() + if ep.Port() != DefaultPort { + host = fmt.Sprintf("%s:%d", ep.Host(), ep.Port()) + } + + return fmt.Sprintf("%s %s%chost=%s%c", cmd, ep.Path(), 0, host, 0) } // Wait no-op function, required by the interface -- cgit