aboutsummaryrefslogtreecommitdiffstats
path: root/submodule_test.go
diff options
context:
space:
mode:
authormatej.risek <matej.risek@hashicorp.com>2023-06-05 14:03:47 +0200
committermatej.risek <matej.risek@hashicorp.com>2023-06-05 14:05:16 +0200
commit9706315a961c52184e2f9111883b08df6ac702b8 (patch)
tree10ae412cf81a54fb7e622265d3fea0675e00f18e /submodule_test.go
parent1dbd729a387edb61c89f088cd68040085e6c81bb (diff)
downloadgo-git-9706315a961c52184e2f9111883b08df6ac702b8.tar.gz
git: fix the issue with submodules having the SCP style URL fail due to the wrong URL parsing
Diffstat (limited to 'submodule_test.go')
-rw-r--r--submodule_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/submodule_test.go b/submodule_test.go
index a8a0681..a066af2 100644
--- a/submodule_test.go
+++ b/submodule_test.go
@@ -6,7 +6,10 @@ import (
"path/filepath"
"testing"
+ "github.com/go-git/go-billy/v5/memfs"
+ "github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
+ "github.com/go-git/go-git/v5/storage/memory"
fixtures "github.com/go-git/go-git-fixtures/v4"
. "gopkg.in/check.v1"
@@ -262,3 +265,26 @@ func (s *SubmoduleSuite) TestSubmodulesFetchDepth(c *C) {
c.Assert(commitCount, Equals, 1)
}
+
+func (s *SubmoduleSuite) TestSubmoduleParseScp(c *C) {
+ repo := &Repository{
+ Storer: memory.NewStorage(),
+ wt: memfs.New(),
+ }
+ worktree := &Worktree{
+ Filesystem: memfs.New(),
+ r: repo,
+ }
+ submodule := &Submodule{
+ initialized: true,
+ c: nil,
+ w: worktree,
+ }
+
+ submodule.c = &config.Submodule{
+ URL: "git@github.com:username/submodule_repo",
+ }
+
+ _, err := submodule.Repository()
+ c.Assert(err, IsNil)
+}