Skip to content

Commit

Permalink
cmd/go: clear GIT_ALLOW_PROTOCOL during tests
Browse files Browse the repository at this point in the history
Clear it before any tests begin.
Clear it again after TestIsSecureGitAllowProtocol sets it.

Fixes #17700.

Change-Id: I6ea50d37f8222d8c7c9fee0b1eac3bbdfb5d133e
Reviewed-on: https://go-review.googlesource.com/32640
Reviewed-by: Quentin Smith <[email protected]>
Run-TryBot: Russ Cox <[email protected]>
  • Loading branch information
rsc committed Nov 3, 2016
1 parent a35decf commit 95e809f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cmd/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func TestMain(m *testing.M) {
// Don't let these environment variables confuse the test.
os.Unsetenv("GOBIN")
os.Unsetenv("GOPATH")
os.Unsetenv("GIT_ALLOW_PROTOCOL")
if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" {
// On some systems the default C compiler is ccache.
// Setting HOME to a non-existent directory will break
Expand Down
1 change: 1 addition & 0 deletions src/cmd/go/vcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ func TestIsSecureGitAllowProtocol(t *testing.T) {
{vcsBzr, "foo://example.com/bar.bzr", false},
}

defer os.Unsetenv("GIT_ALLOW_PROTOCOL")
os.Setenv("GIT_ALLOW_PROTOCOL", "https:foo")
for _, test := range tests {
secure := test.vcs.isSecure(test.url)
Expand Down

0 comments on commit 95e809f

Please sign in to comment.