Set GIT_TERMINAL_PROMPT=0 for clone and fetch

This commit is contained in:
morganamilo 2018-08-02 23:07:36 +01:00
parent 161bc1a17a
commit 297bf31cdf
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E

View File

@ -60,7 +60,9 @@ func gitHasDiff(path string, name string) (bool, error) {
func gitDownload(url string, path string, name string) (bool, error) {
_, err := os.Stat(filepath.Join(path, name, ".git"))
if os.IsNotExist(err) {
_, stderr, err := capture(passToGit(path, "clone", "--no-progress", url, name))
cmd := passToGit(path, "clone", "--no-progress", url, name)
cmd.Env = append(os.Environ(), "GIT_TERMINAL_PROMPT=0")
_, stderr, err := capture(cmd)
if err != nil {
return false, fmt.Errorf("error cloning %s: stderr", name, stderr)
}
@ -70,7 +72,9 @@ func gitDownload(url string, path string, name string) (bool, error) {
return false, fmt.Errorf("error reading %s", filepath.Join(path, name, ".git"))
}
_, stderr, err := capture(passToGit(filepath.Join(path, name), "fetch"))
cmd := passToGit(filepath.Join(path, name), "fetch")
cmd.Env = append(os.Environ(), "GIT_TERMINAL_PROMPT=0")
_, stderr, err := capture(cmd)
if err != nil {
return false, fmt.Errorf("error fetching %s: %s", name, stderr)
}