cmd/go: fix and reenable TestAccidentalGitCheckout
cmd/go: fix and reenable TestAccidentalGitCheckout

This is an important security problem so we shouldn't disable the test.
The second half was failing on case-sensitive file systems but the
first half is still good.

Fixes #22983.

Change-Id: I437bb4c9f78eb3177aa8b619e2357b2539566ca9
Reviewed-on: https://go-review.googlesource.com/129797
Run-TryBot: Russ Cox <5ad239cb8a44f659eaaee0aa1ea5b94947abe557@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>

golang/go,josharian/go,CAFxX/go,akutz/go,nawawi/go,nawawi/go,CAFxX/go,golang/go,akutz/go,nawawi/go,nawawi/go,josharian/go,CAFxX/go,josharian/go,cloudflare/go,cloudflare/go,golang/go,CAFxX/go,nawawi/go,nawawi/go,cloudflare/go,josharian/go,golang/go,golang/go,CAFxX/go,josharian/go,CAFxX/go,akutz/go,cloudflare/go,golang/go,josharian/go,akutz/go,golang/go,golang/go,nawawi/go,CAFxX/go,josharian/go,josharian/go,CAFxX/go,cloudflare/go,akutz/go,cloudflare/go,cloudflare/go,akutz/go,cloudflare/go,akutz/go,akutz/go,nawawi/go