initial clone works

This commit is contained in:
Jeff Carr 2024-03-07 22:08:32 -06:00
parent 2cdf2c3cda
commit 54367ddc72
1 changed files with 6 additions and 1 deletions

7
new.go
View File

@ -80,13 +80,17 @@ func guessPaths(path string) (string, string, string, bool, error) {
realpath = filepath.Join(goSrcDir, path)
isGoLang = true
}
if os.Getenv("REPO_AUTO_CLONE") == "true" {
clone(goSrcDir, path)
}
if !IsDirectory(realpath) {
log.Log(REPOWARN, "directory doesn't exist", realpath)
// directory doesn't exist. exit with nil and error nil
return path, realpath, goSrcDir, false, errors.New(realpath + " does not exist")
}
clone(goSrcDir, path)
filename := filepath.Join(realpath, ".git/config")
_, err = os.Open(filename)
@ -110,6 +114,7 @@ func clone(wdir string, path string) {
}
base := filepath.Join(wdir, filepath.Dir(path))
os.MkdirAll(base, 0750)
shell.RunPath(base, []string{"git", "clone", "http://" + path})
}