From 0ddf8f55a4afbe4d56bbd3fc8546622f7b9b1872 Mon Sep 17 00:00:00 2001 From: "J. Fernando Sánchez" Date: Thu, 28 Sep 2017 18:05:55 +0200 Subject: Fixed SCP regex URLs should be user@server:port/path instead of user@server:port:path --- plumbing/transport/common.go | 2 +- plumbing/transport/common_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plumbing/transport') 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[^@]+)@)?(?P[^:\s]+):(?:(?P[0-9]+):)?(?P[^\\].*)$`) + scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P[^@]+)@)?(?P[^:\s]+):(?:(?P[0-9]{1,5})/)?(?P[^\\].*)$`) ) 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") -- cgit