diff options
author | J. Fernando Sánchez <balkian@gmail.com> | 2017-09-28 17:21:16 +0200 |
---|---|---|
committer | J. Fernando Sánchez <balkian@gmail.com> | 2017-09-28 17:35:46 +0200 |
commit | 04765bb11cbadf22ed01ea12cb6f2834e9ee1ec5 (patch) | |
tree | f7166ce541db95311b43f00c075edc3c588b2fe5 /plumbing/transport/common_test.go | |
parent | 7d1595faba108f5c6c9b678288eb5092ba555bd1 (diff) | |
download | go-git-04765bb11cbadf22ed01ea12cb6f2834e9ee1ec5.tar.gz |
Adds port to SCP Endpoints
The port for SCP-like URLs was hardcoded to 22.
This commit modifies the regex to find a port (optional), and adds a new test
case that covers this scenario.
Diffstat (limited to 'plumbing/transport/common_test.go')
-rw-r--r-- | plumbing/transport/common_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plumbing/transport/common_test.go b/plumbing/transport/common_test.go index ec617bd..f869d44 100644 --- a/plumbing/transport/common_test.go +++ b/plumbing/transport/common_test.go @@ -74,6 +74,18 @@ func (s *SuiteCommon) TestNewEndpointSCPLike(c *C) { c.Assert(e.String(), Equals, "git@github.com:user/repository.git") } +func (s *SuiteCommon) TestNewEndpointSCPLikeWithPort(c *C) { + 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") + c.Assert(e.Password(), Equals, "") + c.Assert(e.Host(), Equals, "github.com") + c.Assert(e.Port(), Equals, 9999) + c.Assert(e.Path(), Equals, "user/repository.git") + c.Assert(e.String(), Equals, "git@github.com:user/repository.git") +} + func (s *SuiteCommon) TestNewEndpointFileAbs(c *C) { e, err := NewEndpoint("/foo.git") c.Assert(err, IsNil) |