1 # Testing stderr for git ls-remote; turn off proxy.
2 [short] skip
3 [!git] skip
4 env GOPROXY=direct
5
6 # Redirect git to a test-specific .gitconfig.
7 # GIT_CONFIG_GLOBAL suffices for git 2.32.0 and newer.
8 # For older git versions we also set $HOME.
9 env GIT_CONFIG_GLOBAL=$WORK${/}home${/}gopher${/}.gitconfig
10 env HOME=$WORK${/}home${/}gopher
11 exec git config --global --show-origin user.name
12 stdout 'Go Gopher'
13
14 ! go mod download vcs-test.golang.org/auth/githttp401.git@latest
15 stderr 'Confirm the import path was entered correctly.'
16 stderr 'If this is a private repository, see https://go.dev/doc/faq#git_https for additional information.'
17 ! stdout .
18
19 # Fetching a nonexistent commit should return an "unknown revision"
20 # error message.
21 ! go mod download vcs-test.golang.org/git/mainonly.git@86186f3aba07ed0212cfb944f3398997d2d07c6b
22 stderr '^go: vcs-test.golang.org/git/mainonly.git@86186f3aba07ed0212cfb944f3398997d2d07c6b: invalid version: unknown revision 86186f3aba07ed0212cfb944f3398997d2d07c6b$'
23 ! stdout .
24
25 ! go mod download vcs-test.golang.org/auth/githttp401.git@master
26 stderr '^Confirm the import path was entered correctly.$'
27 stderr '^If this is a private repository, see https://go.dev/doc/faq#git_https for additional information.$'
28 ! stderr 'unknown revision'
29 ! stdout .
30
31 [!exec:false] stop
32
33 # Test that Git clone errors will be shown to the user instead of a generic
34 # "unknown revision" error. To do this we want to force git ls-remote to return
35 # an error we don't already have special handling for. See golang/go#42751.
36 exec git config --global url.git@vcs-test.golang.org:.insteadOf http://$TESTGO_VCSTEST_HOST/
37 env GIT_SSH_COMMAND=false
38 ! go install vcs-test.golang.org/auth/githttp401.git@master
39 stderr 'fatal: Could not read from remote repository.'
40 ! stderr 'unknown revision'
41 ! stdout .
42
43 -- $WORK/home/gopher/.gitconfig --
44 [user]
45 name = Go Gopher
46 email = gopher@golang.org
47
View as plain text