diff options
author | Santiago M. Mola <santi@mola.io> | 2017-06-12 11:25:39 +0200 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-06-13 14:57:40 +0200 |
commit | 8dee150a302e98c26b92133a80d6b43e4cb31a87 (patch) | |
tree | 7c76c1b37715c0f58f21c7388c4b1271ea24f051 /plumbing/transport | |
parent | 7908196d194b4536b60ccf13914f5722ab97cda4 (diff) | |
download | go-git-8dee150a302e98c26b92133a80d6b43e4cb31a87.tar.gz |
transport/git: ensure port is added to host parameter
Diffstat (limited to 'plumbing/transport')
-rw-r--r-- | plumbing/transport/git/common.go | 7 |
1 files changed, 6 insertions, 1 deletions
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 |