diff options
author | J. Fernando Sánchez <balkian@gmail.com> | 2017-09-28 18:05:55 +0200 |
---|---|---|
committer | J. Fernando Sánchez <balkian@gmail.com> | 2017-09-28 18:05:55 +0200 |
commit | 0ddf8f55a4afbe4d56bbd3fc8546622f7b9b1872 (patch) | |
tree | 01dfffe8aa9f45eb962e22d6cab96fcf0a905767 /plumbing | |
parent | 04765bb11cbadf22ed01ea12cb6f2834e9ee1ec5 (diff) | |
download | go-git-0ddf8f55a4afbe4d56bbd3fc8546622f7b9b1872.tar.gz |
Fixed SCP regex
URLs should be user@server:port/path instead of user@server:port:path
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/transport/common.go | 2 | ||||
-rw-r--r-- | plumbing/transport/common_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/plumbing/transport/common.go b/plumbing/transport/common.go index 202c498..ac71bb3 100644 --- a/plumbing/transport/common.go +++ b/plumbing/transport/common.go @@ -227,7 +227,7 @@ func (e *fileEndpoint) String() string { return e.path } var ( isSchemeRegExp = regexp.MustCompile(`^[^:]+://`) - scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]+):)?(?P<path>[^\\].*)$`) + scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]{1,5})/)?(?P<path>[^\\].*)$`) ) func parseSCPLike(endpoint string) (Endpoint, bool) { diff --git a/plumbing/transport/common_test.go b/plumbing/transport/common_test.go index f869d44..52759e6 100644 --- a/plumbing/transport/common_test.go +++ b/plumbing/transport/common_test.go @@ -75,7 +75,7 @@ func (s *SuiteCommon) TestNewEndpointSCPLike(c *C) { } func (s *SuiteCommon) TestNewEndpointSCPLikeWithPort(c *C) { - e, err := NewEndpoint("git@github.com:9999:user/repository.git") + e, err := NewEndpoint("git@github.com:9999/user/repository.git") c.Assert(err, IsNil) c.Assert(e.Protocol(), Equals, "ssh") c.Assert(e.User(), Equals, "git") |