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