diff options
author | Joseda Rios <josriolop@gmail.com> | 2023-03-16 15:20:01 +0100 |
---|---|---|
committer | Joseda Rios <josriolop@gmail.com> | 2023-04-15 16:05:43 +0200 |
commit | a71389b9d9293a6fefc3c923e765f250235a5262 (patch) | |
tree | 1e7972df2c3952af2ee1070c010ced1ad981910a /plumbing/transport/common_test.go | |
parent | 3f1cfde283c93f33218c807602e93d47f72f7b90 (diff) | |
download | go-git-a71389b9d9293a6fefc3c923e765f250235a5262.tar.gz |
internal: Fix regression in csp-like match
Signed-off-by: Joseda Rios <josriolop@gmail.com>
Diffstat (limited to 'plumbing/transport/common_test.go')
-rw-r--r-- | plumbing/transport/common_test.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/plumbing/transport/common_test.go b/plumbing/transport/common_test.go index 0c5a01a..db11303 100644 --- a/plumbing/transport/common_test.go +++ b/plumbing/transport/common_test.go @@ -95,16 +95,28 @@ func (s *SuiteCommon) TestNewEndpointSCPLike(c *C) { c.Assert(e.String(), Equals, "ssh://git@github.com/user/repository.git") } -func (s *SuiteCommon) TestNewEndpointSCPLikeWithPort(c *C) { +func (s *SuiteCommon) TestNewEndpointSCPLikeWithNumericPath(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, "ssh://git@github.com:9999/user/repository.git") + c.Assert(e.Port, Equals, 22) + c.Assert(e.Path, Equals, "9999/user/repository.git") + c.Assert(e.String(), Equals, "ssh://git@github.com/9999/user/repository.git") +} + +func (s *SuiteCommon) TestNewEndpointSCPLikeWithPort(c *C) { + e, err := NewEndpoint("git@github.com:8080: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, 8080) + c.Assert(e.Path, Equals, "9999/user/repository.git") + c.Assert(e.String(), Equals, "ssh://git@github.com:8080/9999/user/repository.git") } func (s *SuiteCommon) TestNewEndpointFileAbs(c *C) { |