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}) }