diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-10-30 11:34:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 11:34:24 +0100 |
commit | e9c56de2575147bbd38576e94f6e677917d208be (patch) | |
tree | 93e5f22e678d9d417f89d8fe0d9b4d15a699a298 /worktree_test.go | |
parent | 15aedd2ff43c25e0d54d6b488114725a266c79d0 (diff) | |
parent | 81d429bc0f13d05770fa5a824202e07f6f80c001 (diff) | |
download | go-git-e9c56de2575147bbd38576e94f6e677917d208be.tar.gz |
Merge pull request #195 from adracus/fix.relative-submodules
Fix relative submodule resolution
Diffstat (limited to 'worktree_test.go')
-rw-r--r-- | worktree_test.go | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/worktree_test.go b/worktree_test.go index 93a4a9a..8a7586a 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -520,7 +520,6 @@ func (s *WorktreeSuite) TestCheckoutSubmoduleInitialized(c *C) { c.Assert(status.IsClean(), Equals, true) } - func (s *WorktreeSuite) TestCheckoutRelativePathSubmoduleInitialized(c *C) { url := "https://github.com/git-fixtures/submodule.git" r := s.NewRepository(fixtures.ByURL(url).One()) @@ -547,13 +546,29 @@ func (s *WorktreeSuite) TestCheckoutRelativePathSubmoduleInitialized(c *C) { // test submodule path modules, err := w.readGitmodulesFile() - c.Assert(modules.Submodules["basic"].URL, Equals, "git@github.com:git-fixtures/basic.git") - c.Assert(modules.Submodules["itself"].URL, Equals, "git@github.com:git-fixtures/submodule.git") + c.Assert(modules.Submodules["basic"].URL, Equals, "../basic.git") + c.Assert(modules.Submodules["itself"].URL, Equals, "../submodule.git") + + basicSubmodule, err := w.Submodule("basic") + c.Assert(err, IsNil) + basicRepo, err := basicSubmodule.Repository() + c.Assert(err, IsNil) + basicRemotes, err := basicRepo.Remotes() + c.Assert(err, IsNil) + c.Assert(basicRemotes[0].Config().URLs[0], Equals, "https://github.com/git-fixtures/basic.git") + + itselfSubmodule, err := w.Submodule("itself") + c.Assert(err, IsNil) + itselfRepo, err := itselfSubmodule.Repository() + c.Assert(err, IsNil) + itselfRemotes, err := itselfRepo.Remotes() + c.Assert(err, IsNil) + c.Assert(itselfRemotes[0].Config().URLs[0], Equals, "https://github.com/git-fixtures/submodule.git") sub, err := w.Submodules() c.Assert(err, IsNil) - err = sub.Update(&SubmoduleUpdateOptions{Init: true, RecurseSubmodules:DefaultSubmoduleRecursionDepth}) + err = sub.Update(&SubmoduleUpdateOptions{Init: true, RecurseSubmodules: DefaultSubmoduleRecursionDepth}) c.Assert(err, IsNil) status, err := w.Status() |