1 [short] skip
2 [!git] skip
3
4 env GO111MODULE=on
5 env GOPROXY=direct
6 env GOSUMDB=off
7
8 # go mod download with the pseudo-version should invoke git but not have a TagSum or Ref or RepoSum.
9 go mod download -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20170922010558-fc3a09f3dc5c
10 stderr 'git( .*)* fetch'
11 cp stdout hellopseudo.json
12 ! stdout '"(Query|TagPrefix|TagSum|Ref|RepoSum)"'
13 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
14 stdout '"VCS": "git"'
15 stdout '"URL": ".*/git/hello"'
16 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
17 go clean -modcache
18
19 # go mod download vcstest/hello should invoke git, print origin info
20 go mod download -x -json vcs-test.golang.org/git/hello.git@latest
21 stderr 'git( .*)* fetch'
22 cp stdout hello.json
23 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
24 stdout '"VCS": "git"'
25 stdout '"URL": ".*/git/hello"'
26 stdout '"Query": "latest"'
27 ! stdout '"TagPrefix"'
28 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
29 stdout '"Ref": "HEAD"'
30 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
31 ! stdout '"RepoSum"'
32
33 # pseudo-version again should not invoke git fetch (it has the version from the @latest query)
34 # but still be careful not to include a TagSum or a Ref, especially not Ref set to HEAD,
35 # which is easy to do when reusing the cached version from the @latest query.
36 go mod download -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20170922010558-fc3a09f3dc5c
37 ! stderr 'git( .*)* fetch'
38 cp stdout hellopseudo2.json
39 cmpenv hellopseudo.json hellopseudo2.json
40
41 # go mod download vcstest/hello@hash needs to check TagSum to find pseudoversion base.
42 go mod download -x -json vcs-test.golang.org/git/hello.git@fc3a09f3dc5c
43 ! stderr 'git( .*)* fetch'
44 cp stdout hellohash.json
45 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
46 stdout '"Query": "fc3a09f3dc5c"'
47 stdout '"VCS": "git"'
48 stdout '"URL": ".*/git/hello"'
49 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
50 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
51 ! stdout '"RepoSum"'
52
53 # go mod download vcstest/hello/v9 should fail, still print origin info
54 ! go mod download -x -json vcs-test.golang.org/git/hello.git/v9@latest
55 cp stdout hellov9.json
56 stdout '"Version": "latest"'
57 stdout '"Error":.*no matching versions'
58 ! stdout '"TagPrefix"'
59 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
60 stdout '"Ref": "HEAD"'
61 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
62 ! stdout 'RepoSum'
63
64 # go mod download vcstest/hello/sub/v9 should also fail, print origin info with TagPrefix
65 ! go mod download -x -json vcs-test.golang.org/git/hello.git/sub/v9@latest
66 cp stdout hellosubv9.json
67 stdout '"Version": "latest"'
68 stdout '"Error":.*no matching versions'
69 stdout '"TagPrefix": "sub/"'
70 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
71 stdout '"Ref": "HEAD"'
72 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
73 ! stdout 'RepoSum'
74
75 # go mod download vcstest/hello@nonexist should fail, still print origin info
76 ! go mod download -x -json vcs-test.golang.org/git/hello.git@nonexist
77 cp stdout hellononexist.json
78 stdout '"Version": "nonexist"'
79 stdout '"Error":.*unknown revision nonexist'
80 stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
81 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
82
83 # go mod download vcstest/hello@1234567890123456789012345678901234567890 should fail, still print origin info
84 # (40 hex digits is assumed to be a full hash and is a slightly different code path from @nonexist)
85 ! go mod download -x -json vcs-test.golang.org/git/hello.git@1234567890123456789012345678901234567890
86 cp stdout hellononhash.json
87 stdout '"Version": "1234567890123456789012345678901234567890"'
88 stdout '"Error":.*unknown revision 1234567890123456789012345678901234567890'
89 stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
90 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
91
92 # go mod download vcstest/hello@v0.0.0-20220101120101-123456789abc should fail, still print origin info
93 # (non-existent pseudoversion)
94 ! go mod download -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20220101120101-123456789abc
95 cp stdout hellononpseudo.json
96 stdout '"Version": "v0.0.0-20220101120101-123456789abc"'
97 stdout '"Error":.*unknown revision 123456789abc'
98 stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
99 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
100
101 # go mod download vcstest/tagtests should invoke git, print origin info
102 go mod download -x -json vcs-test.golang.org/git/tagtests.git@latest
103 stderr 'git( .*)* fetch'
104 cp stdout tagtests.json
105 stdout '"Version": "v0.2.2"'
106 stdout '"Query": "latest"'
107 stdout '"VCS": "git"'
108 stdout '"URL": ".*/git/tagtests"'
109 ! stdout '"TagPrefix"'
110 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
111 stdout '"Ref": "refs/tags/v0.2.2"'
112 stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
113 ! stdout '"RepoSum"'
114
115 # go mod download vcstest/tagtests@v0.2.2 should print origin info, no TagSum needed
116 go mod download -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
117 cp stdout tagtestsv022.json
118 stdout '"Version": "v0.2.2"'
119 ! stdout '"Query":'
120 stdout '"VCS": "git"'
121 stdout '"URL": ".*/git/tagtests"'
122 ! stdout '"TagPrefix"'
123 ! stdout '"TagSum"'
124 stdout '"Ref": "refs/tags/v0.2.2"'
125 stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
126 ! stdout '"RepoSum"'
127
128 # go mod download vcstest/tagtests@master needs a TagSum again
129 go mod download -x -json vcs-test.golang.org/git/tagtests.git@master
130 cp stdout tagtestsmaster.json
131 stdout '"Version": "v0.2.3-0.20190509225625-c7818c24fa2f"'
132 stdout '"Query": "master"'
133 stdout '"VCS": "git"'
134 stdout '"URL": ".*/git/tagtests"'
135 ! stdout '"TagPrefix"'
136 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
137 stdout '"Ref": "refs/heads/master"'
138 stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"'
139 ! stdout '"RepoSum"'
140
141 # go mod download vcstest/prefixtagtests should invoke git, print origin info
142 go mod download -x -json vcs-test.golang.org/git/prefixtagtests.git/sub@latest
143 stderr 'git( .*)* fetch'
144 cp stdout prefixtagtests.json
145 stdout '"Version": "v0.0.10"'
146 stdout '"Query": "latest"'
147 stdout '"VCS": "git"'
148 stdout '"URL": ".*/git/prefixtagtests"'
149 stdout '"Subdir": "sub"'
150 stdout '"TagPrefix": "sub/"'
151 stdout '"TagSum": "t1:YGSbWkJ8dn9ORAr[+]BlKHFK/2ZhXLb9hVuYfTZ9D8C7g="'
152 stdout '"Ref": "refs/tags/sub/v0.0.10"'
153 stdout '"Hash": "2b7c4692e12c109263cab51b416fcc835ddd7eae"'
154 ! stdout '"RepoSum"'
155
156 # go mod download of a bunch of these should fail (some are invalid) but write good JSON for later
157 ! go mod download -json vcs-test.golang.org/git/hello.git@latest vcs-test.golang.org/git/hello.git/v9@latest vcs-test.golang.org/git/hello.git/sub/v9@latest vcs-test.golang.org/git/tagtests.git@latest vcs-test.golang.org/git/tagtests.git@v0.2.2 vcs-test.golang.org/git/tagtests.git@master
158 cp stdout all.json
159
160 # clean the module cache, make sure that makes go mod download re-run git fetch, clean again
161 go clean -modcache
162 go mod download -x -json vcs-test.golang.org/git/hello.git@latest
163 stderr 'git( .*)* fetch'
164 go clean -modcache
165
166 # reuse go mod download vcstest/hello result
167 go clean -modcache
168 go mod download -reuse=hello.json -x -json vcs-test.golang.org/git/hello.git@latest
169 ! stderr 'git( .*)* fetch'
170 stdout '"Reuse": true'
171 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
172 stdout '"VCS": "git"'
173 stdout '"URL": ".*/git/hello"'
174 ! stdout '"TagPrefix"'
175 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
176 stdout '"Ref": "HEAD"'
177 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
178 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
179
180 # reuse go mod download vcstest/hello pseudoversion result
181 go clean -modcache
182 go mod download -reuse=hellopseudo.json -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20170922010558-fc3a09f3dc5c
183 ! stderr 'git( .*)* fetch'
184 stdout '"Reuse": true'
185 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
186 stdout '"VCS": "git"'
187 stdout '"URL": ".*/git/hello"'
188 ! stdout '"(Query|TagPrefix|TagSum|Ref)"'
189 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
190 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
191
192 # reuse go mod download vcstest/hello@hash
193 go clean -modcache
194 go mod download -reuse=hellohash.json -x -json vcs-test.golang.org/git/hello.git@fc3a09f3dc5c
195 ! stderr 'git( .*)* fetch'
196 stdout '"Reuse": true'
197 stdout '"Query": "fc3a09f3dc5c"'
198 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
199 stdout '"VCS": "git"'
200 stdout '"URL": ".*/git/hello"'
201 ! stdout '"(TagPrefix|Ref)"'
202 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
203 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
204 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
205
206 # reuse go mod download vcstest/hello/v9 error result
207 go clean -modcache
208 ! go mod download -reuse=hellov9.json -x -json vcs-test.golang.org/git/hello.git/v9@latest
209 ! stderr 'git( .*)* fetch'
210 stdout '"Reuse": true'
211 stdout '"Error":.*no matching versions'
212 ! stdout '"TagPrefix"'
213 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
214 stdout '"Ref": "HEAD"'
215 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
216 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
217
218 # reuse go mod download vcstest/hello/sub/v9 error result
219 go clean -modcache
220 ! go mod download -reuse=hellosubv9.json -x -json vcs-test.golang.org/git/hello.git/sub/v9@latest
221 ! stderr 'git( .*)* fetch'
222 stdout '"Reuse": true'
223 stdout '"Error":.*no matching versions'
224 stdout '"TagPrefix": "sub/"'
225 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
226 stdout '"Ref": "HEAD"'
227 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
228 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
229
230 # reuse go mod download vcstest/hello@nonexist
231 go clean -modcache
232 ! go mod download -reuse=hellononexist.json -x -json vcs-test.golang.org/git/hello.git@nonexist
233 ! stderr 'git( .*)* fetch'
234 stdout '"Reuse": true'
235 stdout '"Version": "nonexist"'
236 stdout '"Error":.*unknown revision nonexist'
237 stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
238 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
239 ! stdout '"(Dir|Info|GoMod|Zip)"'
240
241 # reuse go mod download vcstest/hello@1234567890123456789012345678901234567890
242 go clean -modcache
243 ! go mod download -reuse=hellononhash.json -x -json vcs-test.golang.org/git/hello.git@1234567890123456789012345678901234567890
244 ! stderr 'git( .*)* fetch'
245 stdout '"Reuse": true'
246 stdout '"Version": "1234567890123456789012345678901234567890"'
247 stdout '"Error":.*unknown revision 1234567890123456789012345678901234567890'
248 stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
249 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
250 ! stdout '"(Dir|Info|GoMod|Zip)"'
251
252 # reuse go mod download vcstest/hello@v0.0.0-20220101120101-123456789abc
253 go clean -modcache
254 ! go mod download -reuse=hellononpseudo.json -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20220101120101-123456789abc
255 ! stderr 'git( .*)* fetch'
256 stdout '"Reuse": true'
257 stdout '"Version": "v0.0.0-20220101120101-123456789abc"'
258 stdout '"Error":.*unknown revision 123456789abc'
259 stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
260 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
261 ! stdout '"(Dir|Info|GoMod|Zip)"'
262
263 # reuse go mod download vcstest/tagtests result
264 go clean -modcache
265 go mod download -reuse=tagtests.json -x -json vcs-test.golang.org/git/tagtests.git@latest
266 ! stderr 'git( .*)* fetch'
267 stdout '"Reuse": true'
268 stdout '"Version": "v0.2.2"'
269 stdout '"Query": "latest"'
270 stdout '"VCS": "git"'
271 stdout '"URL": ".*/git/tagtests"'
272 ! stdout '"TagPrefix"'
273 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
274 stdout '"Ref": "refs/tags/v0.2.2"'
275 stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
276 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
277
278 # reuse go mod download vcstest/tagtests@v0.2.2 result
279 go clean -modcache
280 go mod download -reuse=tagtestsv022.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
281 ! stderr 'git( .*)* fetch'
282 stdout '"Reuse": true'
283 stdout '"Version": "v0.2.2"'
284 ! stdout '"Query":'
285 stdout '"VCS": "git"'
286 stdout '"URL": ".*/git/tagtests"'
287 ! stdout '"TagPrefix"'
288 ! stdout '"TagSum"'
289 stdout '"Ref": "refs/tags/v0.2.2"'
290 stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
291 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
292
293 # reuse go mod download vcstest/tagtests@master result
294 go clean -modcache
295 go mod download -reuse=tagtestsmaster.json -x -json vcs-test.golang.org/git/tagtests.git@master
296 ! stderr 'git( .*)* fetch'
297 stdout '"Reuse": true'
298 stdout '"Version": "v0.2.3-0.20190509225625-c7818c24fa2f"'
299 stdout '"Query": "master"'
300 stdout '"VCS": "git"'
301 stdout '"URL": ".*/git/tagtests"'
302 ! stdout '"TagPrefix"'
303 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
304 stdout '"Ref": "refs/heads/master"'
305 stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"'
306 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
307
308 # reuse go mod download vcstest/tagtests@master result again with all.json
309 go clean -modcache
310 go mod download -reuse=all.json -x -json vcs-test.golang.org/git/tagtests.git@master
311 ! stderr 'git( .*)* fetch'
312 stdout '"Reuse": true'
313 stdout '"Version": "v0.2.3-0.20190509225625-c7818c24fa2f"'
314 stdout '"Query": "master"'
315 stdout '"VCS": "git"'
316 stdout '"URL": ".*/git/tagtests"'
317 ! stdout '"TagPrefix"'
318 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
319 stdout '"Ref": "refs/heads/master"'
320 stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"'
321 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
322
323 # go mod download vcstest/prefixtagtests result with json
324 go clean -modcache
325 go mod download -reuse=prefixtagtests.json -x -json vcs-test.golang.org/git/prefixtagtests.git/sub@latest
326 ! stderr 'git( .*)* fetch'
327 stdout '"Version": "v0.0.10"'
328 stdout '"Query": "latest"'
329 stdout '"VCS": "git"'
330 stdout '"URL": ".*/git/prefixtagtests"'
331 stdout '"Subdir": "sub"'
332 stdout '"TagPrefix": "sub/"'
333 stdout '"TagSum": "t1:YGSbWkJ8dn9ORAr[+]BlKHFK/2ZhXLb9hVuYfTZ9D8C7g="'
334 stdout '"Ref": "refs/tags/sub/v0.0.10"'
335 stdout '"Hash": "2b7c4692e12c109263cab51b416fcc835ddd7eae"'
336 ! stdout '"(Dir|Info|GoMod|Zip)"'
337
338 # reuse the bulk results with all.json
339 go clean -modcache
340 ! go mod download -reuse=all.json -json vcs-test.golang.org/git/hello.git@latest vcs-test.golang.org/git/hello.git/v9@latest vcs-test.golang.org/git/hello.git/sub/v9@latest vcs-test.golang.org/git/tagtests.git@latest vcs-test.golang.org/git/tagtests.git@v0.2.2 vcs-test.golang.org/git/tagtests.git@master
341 ! stderr 'git( .*)* fetch'
342 stdout '"Reuse": true'
343 ! stdout '"(Dir|Info|GoMod|Zip)"'
344
345 # reuse attempt with stale hash should reinvoke git, not report reuse
346 go clean -modcache
347 cp tagtestsv022.json tagtestsv022badhash.json
348 replace '57952' '56952XXX' tagtestsv022badhash.json
349 go mod download -reuse=tagtestsv022badhash.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
350 stderr 'git( .*)* fetch'
351 ! stdout '"Reuse": true'
352 stdout '"Version": "v0.2.2"'
353 ! stdout '"Query"'
354 stdout '"VCS": "git"'
355 stdout '"URL": ".*/git/tagtests"'
356 ! stdout '"(TagPrefix|TagSum|RepoSum)"'
357 stdout '"Ref": "refs/tags/v0.2.2"'
358 stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
359 stdout '"Dir"'
360 stdout '"Info"'
361 stdout '"GoMod"'
362 stdout '"Zip"'
363
364 # reuse with stale repo URL
365 go clean -modcache
366 cp tagtestsv022.json tagtestsv022badurl.json
367 replace 'git/tagtests\"' 'git/tagtestsXXX\"' tagtestsv022badurl.json
368 go mod download -reuse=tagtestsv022badurl.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
369 ! stdout '"Reuse": true'
370 stdout '"URL": ".*/git/tagtests"'
371 stdout '"Dir"'
372 stdout '"Info"'
373 stdout '"GoMod"'
374 stdout '"Zip"'
375
376 # reuse with stale VCS
377 go clean -modcache
378 cp tagtestsv022.json tagtestsv022badvcs.json
379 replace '\"git\"' '\"gitXXX\"' tagtestsv022badvcs.json
380 go mod download -reuse=tagtestsv022badvcs.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
381 ! stdout '"Reuse": true'
382 stdout '"URL": ".*/git/tagtests"'
383 ! stdout '"RepoSum"'
384
385 # reuse with stale Dir
386 go clean -modcache
387 cp tagtestsv022.json tagtestsv022baddir.json
388 replace '\t\t\"Ref\":' '\t\t\"Subdir\": \"subdir\",\n\t\t\"Ref\":' tagtestsv022baddir.json
389 go mod download -reuse=tagtestsv022baddir.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
390 ! stdout '"Reuse": true'
391 stdout '"URL": ".*/git/tagtests"'
392 ! stdout '"RepoSum"'
393
394 # reuse with stale TagSum
395 go clean -modcache
396 cp tagtests.json tagtestsbadtagsum.json
397 replace 'sMEOGo=' 'sMEoGo=XXX' tagtestsbadtagsum.json
398 go mod download -reuse=tagtestsbadtagsum.json -x -json vcs-test.golang.org/git/tagtests.git@latest
399 ! stdout '"Reuse": true'
400 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
401 ! stdout '"RepoSum"'
402
403 # go list on repo with no tags
404 go clean -modcache
405 go list -x -json -m -retracted -versions vcs-test.golang.org/git/hello.git@latest
406 stderr 'git( .*)* fetch'
407 cp stdout hellolist.json
408 ! stdout '"Versions"'
409 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
410 stdout '"VCS": "git"'
411 stdout '"URL": ".*/git/hello"'
412 stdout '"Query": "latest"'
413 ! stdout '"TagPrefix"'
414 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
415 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
416 ! stdout '"RepoSum"'
417
418 # reuse go list on repo with no tags
419 go clean -modcache
420 go list -x -reuse=hellolist.json -json -m -retracted -versions vcs-test.golang.org/git/hello.git@latest
421 ! stderr 'git( .*)* fetch'
422 stdout '"Reuse": true'
423 ! stdout '"Versions"'
424 stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
425 stdout '"VCS": "git"'
426 stdout '"URL": ".*/git/hello"'
427 stdout '"Query": "latest"'
428 ! stdout '"TagPrefix"'
429 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
430 stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
431 ! stdout '"RepoSum"'
432
433 # reuse with stale list
434 go clean -modcache
435 cp hellolist.json hellolistbad.json
436 replace '47DEQ' 'ZZZ' hellolistbad.json
437 go clean -modcache
438 go list -x -reuse=hellolistbad.json -json -m -retracted -versions vcs-test.golang.org/git/hello.git@latest
439 stderr 'git( .*)* fetch'
440 ! stdout '"Reuse": true'
441 stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
442
443 # go list on repo with tags
444 go clean -modcache
445 go list -x -json -m -retracted -versions vcs-test.golang.org/git/tagtests.git@latest
446 cp stdout taglist.json
447 stderr 'git( .*)* fetch'
448 stdout '"Versions":'
449 stdout '"v0.2.1"'
450 stdout '"v0.2.2"'
451 stdout '"Version": "v0.2.2"'
452 stdout '"VCS": "git"'
453 stdout '"URL": ".*/git/tagtests"'
454 stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
455 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
456 stdout '"Ref": "refs/tags/v0.2.2"'
457
458 # reuse go list on repo with tags
459 go clean -modcache
460 go list -reuse=taglist.json -x -json -m -retracted -versions vcs-test.golang.org/git/tagtests.git@latest
461 ! stderr 'git( .*)* fetch'
462 stdout '"Reuse": true'
463 stdout '"Versions":'
464 stdout '"v0.2.1"'
465 stdout '"v0.2.2"'
466 stdout '"Version": "v0.2.2"'
467 stdout '"VCS": "git"'
468 stdout '"URL": ".*/git/tagtests"'
469 stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
470 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
471 stdout '"Ref": "refs/tags/v0.2.2"'
472
473 # reuse with stale list
474 go clean -modcache
475 cp taglist.json taglistbad.json
476 replace 'Dp7yRKDu' 'ZZZ' taglistbad.json
477 go list -reuse=taglistbad.json -x -json -m -retracted -versions vcs-test.golang.org/git/tagtests.git@latest
478 stderr 'git( .*)* fetch'
479 ! stdout '"Reuse": true'
480 stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
481
View as plain text