]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: don't override GIT_TERMINAL_PROMPT
authorBurcu Dogan <jbd@google.com>
Mon, 19 Oct 2015 22:27:19 +0000 (15:27 -0700)
committerAndrew Gerrand <adg@golang.org>
Mon, 19 Oct 2015 23:05:52 +0000 (23:05 +0000)
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>
src/cmd/go/get.go

index 283de18ebad2fd4a09a3f5dbd2ebf4492ea98308..aac21a0f22ad46e623dc508474f346d3b86ab005 100644 (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