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