1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:54:49 -07:00

cmd/go: don't override GIT_TERMINAL_PROMPT

This CL keeps disallowing `go get` from falling to the prompt unless
user has set GIT_TERMINAL_PROMPT env variable. If GIT_TERMINAL_PROMPT
is set, go-get will not override its value and will prompt for
username/password in the case of GIT_TERMINAL_PROMPT=1.

Fixes #12706.

Change-Id: Ibd6b1100af6b04fb8114279cdcf608943e7765be
Reviewed-on: https://go-review.googlesource.com/16091
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Burcu Dogan 2015-10-19 15:27:19 -07:00 committed by Andrew Gerrand
parent 88fa2e0be6
commit 4dc49d23a7

View File

@ -84,8 +84,12 @@ func runGet(cmd *Command, args []string) {
// Disable any prompting for passwords by Git.
// Only has an effect for 2.3.0 or later, but avoiding
// the prompt in earlier versions is just too hard.
// See golang.org/issue/9341.
os.Setenv("GIT_TERMINAL_PROMPT", "0")
// If user has explicitly set GIT_TERMINAL_PROMPT=1, keep
// prompting.
// See golang.org/issue/9341 and golang.org/issue/12706.
if v := os.Getenv("GIT_TERMINAL_PROMPT"); v == "" {
os.Setenv("GIT_TERMINAL_PROMPT", "0")
}
// Phase 1. Download/update.
var stk importStack