Skip to content

Commit 95e809f

Browse files
committed
cmd/go: clear GIT_ALLOW_PROTOCOL during tests
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]>
1 parent a35decf commit 95e809f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/cmd/go/go_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func TestMain(m *testing.M) {
9999
// Don't let these environment variables confuse the test.
100100
os.Unsetenv("GOBIN")
101101
os.Unsetenv("GOPATH")
102+
os.Unsetenv("GIT_ALLOW_PROTOCOL")
102103
if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" {
103104
// On some systems the default C compiler is ccache.
104105
// Setting HOME to a non-existent directory will break

src/cmd/go/vcs_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ func TestIsSecureGitAllowProtocol(t *testing.T) {
271271
{vcsBzr, "foo://example.com/bar.bzr", false},
272272
}
273273

274+
defer os.Unsetenv("GIT_ALLOW_PROTOCOL")
274275
os.Setenv("GIT_ALLOW_PROTOCOL", "https:foo")
275276
for _, test := range tests {
276277
secure := test.vcs.isSecure(test.url)

0 commit comments

Comments
 (0)