Commit 95e809f0 authored by Russ Cox's avatar Russ Cox

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/32640Reviewed-by: 's avatarQuentin Smith <quentin@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
parent a35decf5
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment