initial clone works
This commit is contained in:
parent
2cdf2c3cda
commit
54367ddc72
7
new.go
7
new.go
|
@ -80,13 +80,17 @@ func guessPaths(path string) (string, string, string, bool, error) {
|
||||||
realpath = filepath.Join(goSrcDir, path)
|
realpath = filepath.Join(goSrcDir, path)
|
||||||
isGoLang = true
|
isGoLang = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if os.Getenv("REPO_AUTO_CLONE") == "true" {
|
||||||
|
clone(goSrcDir, path)
|
||||||
|
}
|
||||||
|
|
||||||
if !IsDirectory(realpath) {
|
if !IsDirectory(realpath) {
|
||||||
log.Log(REPOWARN, "directory doesn't exist", realpath)
|
log.Log(REPOWARN, "directory doesn't exist", realpath)
|
||||||
// directory doesn't exist. exit with nil and error nil
|
// directory doesn't exist. exit with nil and error nil
|
||||||
return path, realpath, goSrcDir, false, errors.New(realpath + " does not exist")
|
return path, realpath, goSrcDir, false, errors.New(realpath + " does not exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
clone(goSrcDir, path)
|
|
||||||
filename := filepath.Join(realpath, ".git/config")
|
filename := filepath.Join(realpath, ".git/config")
|
||||||
|
|
||||||
_, err = os.Open(filename)
|
_, err = os.Open(filename)
|
||||||
|
@ -110,6 +114,7 @@ func clone(wdir string, path string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
base := filepath.Join(wdir, filepath.Dir(path))
|
base := filepath.Join(wdir, filepath.Dir(path))
|
||||||
|
os.MkdirAll(base, 0750)
|
||||||
shell.RunPath(base, []string{"git", "clone", "http://" + path})
|
shell.RunPath(base, []string{"git", "clone", "http://" + path})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue