From 54367ddc72ddb608e3ad5c7c39add24c9b708662 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 7 Mar 2024 22:08:32 -0600 Subject: [PATCH] initial clone works --- new.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/new.go b/new.go index b4acda4..56efc07 100644 --- a/new.go +++ b/new.go @@ -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}) }