diff --git a/internal/homesick/core/clone_test.go b/internal/homesick/core/clone_test.go index d472a9c..5a46bd9 100644 --- a/internal/homesick/core/clone_test.go +++ b/internal/homesick/core/clone_test.go @@ -73,9 +73,8 @@ func (s *CloneSuite) createBareRemote(name string) string { return remotePath } -func (s *CloneSuite) TestClone_FileURLWorksWithoutGitInPath() { +func (s *CloneSuite) TestClone_FileURLWorks() { remotePath := s.createBareRemote("castle") - s.T().Setenv("PATH", "") err := s.app.Clone("file://"+remotePath, "parity-castle") require.NoError(s.T(), err) diff --git a/internal/homesick/core/core.go b/internal/homesick/core/core.go index 1c14a7f..d115de9 100644 --- a/internal/homesick/core/core.go +++ b/internal/homesick/core/core.go @@ -10,6 +10,8 @@ import ( "path/filepath" "sort" "strings" + + git "github.com/go-git/go-git/v5" ) type App struct { @@ -70,8 +72,12 @@ func (a *App) Clone(uri string, destination string) error { return nil } - if err := runGit(a.ReposDir, "clone", "-q", "--config", "push.default=upstream", "--recursive", uri, destination); err != nil { - return err + _, err := git.PlainClone(destinationPath, false, &git.CloneOptions{ + URL: uri, + RecurseSubmodules: git.DefaultSubmoduleRecursionDepth, + }) + if err != nil { + return fmt.Errorf("clone %q into %q failed: %w", uri, destinationPath, err) } return nil