1 [short] skip 'generates a vcstest git repo'
2 [!git] skip
3
4 env GOPROXY=direct
5
6 # Control case: fetching a nested module at a tag that exists should
7 # emit Origin metadata for that tag and commit, and the origin should
8 # be reusable for that tag.
9
10 go list -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@has-nested
11 cp stdout has-nested.json
12 stdout '"Origin":'
13 stdout '"VCS": "git"'
14 stdout '"URL":' # randomly-chosen vcweb localhost URL
15 stdout '"Subdir": "nested"'
16 stdout '"TagPrefix": "nested/"'
17 stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
18 stdout '"Ref": "refs/tags/has-nested"'
19 stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
20
21 go list -reuse=has-nested.json -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@has-nested
22 stdout '"Origin":'
23 stdout '"VCS": "git"'
24 stdout '"URL":' # randomly-chosen vcweb localhost URL
25 stdout '"Subdir": "nested"'
26 stdout '"TagPrefix": "nested/"'
27 stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
28 stdout '"Ref": "refs/tags/has-nested"'
29 stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
30 stdout '"Reuse": true'
31
32
33 # Experiment case: if the nested module doesn't exist at "latest",
34 # the Origin metadata should include the ref that we tried to resolve
35 # (HEAD for a repo without version tags) and the hash to which it refers,
36 # so that changing the HEAD ref will invalidate the result.
37
38 go list -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@latest
39 cp stdout no-nested.json
40 stdout '"Err": "module vcs-test.golang.org/git/issue61415.git/nested: no matching versions for query \\"latest\\""'
41 stdout '"URL":' # randomly-chosen vcweb localhost URL
42 stdout '"Subdir": "nested"'
43 stdout '"TagPrefix": "nested/"'
44 stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
45
46 stdout '"Ref": "HEAD"'
47 stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
48
49 # The error result should be reusable.
50
51 go list -reuse=no-nested.json -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@latest
52
53 stdout '"Err": "module vcs-test.golang.org/git/issue61415.git/nested: no matching versions for query \\"latest\\""'
54 stdout '"URL":' # randomly-chosen vcweb localhost URL
55 stdout '"Subdir": "nested"'
56 stdout '"TagPrefix": "nested/"'
57 stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
58 stdout '"Ref": "HEAD"'
59 stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
60 stdout '"Reuse": true'
61
62
63 # If the hash refers to some other commit instead, the
64 # result should not be reused.
65
66 replace f213069baa68ec26412fb373c7cf6669db1f8e69 08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a no-nested.json
67
68 go list -reuse=no-nested.json -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@latest
69 stdout '"Err": "module vcs-test.golang.org/git/issue61415.git/nested: no matching versions for query \\"latest\\""'
70 stdout '"URL":' # randomly-chosen vcweb localhost URL
71 stdout '"Subdir": "nested"'
72 stdout '"TagPrefix": "nested/"'
73 stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
74 stdout '"Ref": "HEAD"'
75 stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
76 ! stdout '"Reuse"'
77
View as plain text