@@ -14,6 +14,7 @@ stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
1414stdout '"VCS": "git"'
1515stdout '"URL": ".*/git/hello"'
1616stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
17+ ! stdout '"RepoSum"'
1718go clean -modcache
1819
1920# go mod download vcstest/hello should invoke git, print origin info
@@ -28,6 +29,7 @@ stdout '"Query": "latest"'
2829stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
2930stdout '"Ref": "HEAD"'
3031stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
32+ ! stdout '"RepoSum"'
3133
3234# pseudo-version again should not invoke git fetch (it has the version from the @latest query)
3335# but still be careful not to include a TagSum or a Ref, especially not Ref set to HEAD,
@@ -47,6 +49,7 @@ stdout '"VCS": "git"'
4749stdout '"URL": ".*/git/hello"'
4850stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
4951stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
52+ ! stdout '"RepoSum"'
5053
5154# go mod download vcstest/hello/v9 should fail, still print origin info
5255! go mod download -x -json vcs-test.golang.org/git/hello.git/v9@latest
@@ -108,6 +111,7 @@ stdout '"URL": ".*/git/tagtests"'
108111stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
109112stdout '"Ref": "refs/tags/v0.2.2"'
110113stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
114+ ! stdout '"RepoSum"'
111115
112116# go mod download vcstest/tagtests@v0.2.2 should print origin info, no TagSum needed
113117go mod download -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
@@ -120,6 +124,7 @@ stdout '"URL": ".*/git/tagtests"'
120124! stdout '"TagSum"'
121125stdout '"Ref": "refs/tags/v0.2.2"'
122126stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
127+ ! stdout '"RepoSum"'
123128
124129# go mod download vcstest/tagtests@master needs a TagSum again
125130go mod download -x -json vcs-test.golang.org/git/tagtests.git@master
@@ -132,6 +137,7 @@ stdout '"URL": ".*/git/tagtests"'
132137stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
133138stdout '"Ref": "refs/heads/master"'
134139stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"'
140+ ! stdout '"RepoSum"'
135141
136142# go mod download vcstest/prefixtagtests should invoke git, print origin info
137143go mod download -x -json vcs-test.golang.org/git/prefixtagtests.git/sub@latest
@@ -146,6 +152,7 @@ stdout '"TagPrefix": "sub/"'
146152stdout '"TagSum": "t1:YGSbWkJ8dn9ORAr[+]BlKHFK/2ZhXLb9hVuYfTZ9D8C7g="'
147153stdout '"Ref": "refs/tags/sub/v0.0.10"'
148154stdout '"Hash": "2b7c4692e12c109263cab51b416fcc835ddd7eae"'
155+ ! stdout '"RepoSum"'
149156
150157# go mod download of a bunch of these should fail (some are invalid) but write good JSON for later
151158! 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,6 +165,7 @@ stderr 'git( .*)* fetch'
158165go clean -modcache
159166
160167# reuse go mod download vcstest/hello result
168+ go clean -modcache
161169go mod download -reuse=hello.json -x -json vcs-test.golang.org/git/hello.git@latest
162170! stderr 'git( .*)* fetch'
163171stdout '"Reuse": true'
@@ -168,12 +176,10 @@ stdout '"URL": ".*/git/hello"'
168176stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
169177stdout '"Ref": "HEAD"'
170178stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
171- ! stdout '"Dir"'
172- ! stdout '"Info"'
173- ! stdout '"GoMod"'
174- ! stdout '"Zip"'
179+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
175180
176181# reuse go mod download vcstest/hello pseudoversion result
182+ go clean -modcache
177183go mod download -reuse=hellopseudo.json -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20170922010558-fc3a09f3dc5c
178184! stderr 'git( .*)* fetch'
179185stdout '"Reuse": true'
@@ -182,9 +188,10 @@ stdout '"VCS": "git"'
182188stdout '"URL": ".*/git/hello"'
183189! stdout '"(Query|TagPrefix|TagSum|Ref)"'
184190stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
185- ! stdout '"(Dir|Info|GoMod|Zip)"'
191+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
186192
187193# reuse go mod download vcstest/hello@hash
194+ go clean -modcache
188195go mod download -reuse=hellohash.json -x -json vcs-test.golang.org/git/hello.git@fc3a09f3dc5c
189196! stderr 'git( .*)* fetch'
190197stdout '"Reuse": true'
@@ -195,9 +202,10 @@ stdout '"URL": ".*/git/hello"'
195202! stdout '"(TagPrefix|Ref)"'
196203stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
197204stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
198- ! stdout '"(Dir|Info|GoMod|Zip)"'
205+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
199206
200207# reuse go mod download vcstest/hello/v9 error result
208+ go clean -modcache
201209! go mod download -reuse=hellov9.json -x -json vcs-test.golang.org/git/hello.git/v9@latest
202210! stderr 'git( .*)* fetch'
203211stdout '"Reuse": true'
@@ -206,9 +214,10 @@ stdout '"Error":.*no matching versions'
206214stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
207215stdout '"Ref": "HEAD"'
208216stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
209- ! stdout '"(Dir|Info|GoMod|Zip)"'
217+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
210218
211219# reuse go mod download vcstest/hello/sub/v9 error result
220+ go clean -modcache
212221! go mod download -reuse=hellosubv9.json -x -json vcs-test.golang.org/git/hello.git/sub/v9@latest
213222! stderr 'git( .*)* fetch'
214223stdout '"Reuse": true'
@@ -217,9 +226,10 @@ stdout '"TagPrefix": "sub/"'
217226stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
218227stdout '"Ref": "HEAD"'
219228stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
220- ! stdout '"(Dir|Info|GoMod|Zip)"'
229+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
221230
222231# reuse go mod download vcstest/hello@nonexist
232+ go clean -modcache
223233! go mod download -reuse=hellononexist.json -x -json vcs-test.golang.org/git/hello.git@nonexist
224234! stderr 'git( .*)* fetch'
225235stdout '"Reuse": true'
@@ -230,6 +240,7 @@ stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
230240! stdout '"(Dir|Info|GoMod|Zip)"'
231241
232242# reuse go mod download vcstest/hello@1234567890123456789012345678901234567890
243+ go clean -modcache
233244! go mod download -reuse=hellononhash.json -x -json vcs-test.golang.org/git/hello.git@1234567890123456789012345678901234567890
234245! stderr 'git( .*)* fetch'
235246stdout '"Reuse": true'
@@ -240,6 +251,7 @@ stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
240251! stdout '"(Dir|Info|GoMod|Zip)"'
241252
242253# reuse go mod download vcstest/hello@v0.0.0-20220101120101-123456789abc
254+ go clean -modcache
243255! go mod download -reuse=hellononpseudo.json -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20220101120101-123456789abc
244256! stderr 'git( .*)* fetch'
245257stdout '"Reuse": true'
@@ -250,6 +262,7 @@ stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="'
250262! stdout '"(Dir|Info|GoMod|Zip)"'
251263
252264# reuse go mod download vcstest/tagtests result
265+ go clean -modcache
253266go mod download -reuse=tagtests.json -x -json vcs-test.golang.org/git/tagtests.git@latest
254267! stderr 'git( .*)* fetch'
255268stdout '"Reuse": true'
@@ -261,9 +274,10 @@ stdout '"URL": ".*/git/tagtests"'
261274stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
262275stdout '"Ref": "refs/tags/v0.2.2"'
263276stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
264- ! stdout '"(Dir|Info|GoMod|Zip)"'
277+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
265278
266279# reuse go mod download vcstest/tagtests@v0.2.2 result
280+ go clean -modcache
267281go mod download -reuse=tagtestsv022.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
268282! stderr 'git( .*)* fetch'
269283stdout '"Reuse": true'
@@ -275,9 +289,10 @@ stdout '"URL": ".*/git/tagtests"'
275289! stdout '"TagSum"'
276290stdout '"Ref": "refs/tags/v0.2.2"'
277291stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
278- ! stdout '"(Dir|Info|GoMod|Zip)"'
292+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
279293
280294# reuse go mod download vcstest/tagtests@master result
295+ go clean -modcache
281296go mod download -reuse=tagtestsmaster.json -x -json vcs-test.golang.org/git/tagtests.git@master
282297! stderr 'git( .*)* fetch'
283298stdout '"Reuse": true'
@@ -289,9 +304,10 @@ stdout '"URL": ".*/git/tagtests"'
289304stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
290305stdout '"Ref": "refs/heads/master"'
291306stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"'
292- ! stdout '"(Dir|Info|GoMod|Zip)"'
307+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
293308
294309# reuse go mod download vcstest/tagtests@master result again with all.json
310+ go clean -modcache
295311go mod download -reuse=all.json -x -json vcs-test.golang.org/git/tagtests.git@master
296312! stderr 'git( .*)* fetch'
297313stdout '"Reuse": true'
@@ -303,9 +319,10 @@ stdout '"URL": ".*/git/tagtests"'
303319stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
304320stdout '"Ref": "refs/heads/master"'
305321stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"'
306- ! stdout '"(Dir|Info|GoMod|Zip)"'
322+ ! stdout '"(Dir|Info|GoMod|Zip|RepoSum )"'
307323
308324# go mod download vcstest/prefixtagtests result with json
325+ go clean -modcache
309326go mod download -reuse=prefixtagtests.json -x -json vcs-test.golang.org/git/prefixtagtests.git/sub@latest
310327! stderr 'git( .*)* fetch'
311328stdout '"Version": "v0.0.10"'
@@ -320,12 +337,14 @@ stdout '"Hash": "2b7c4692e12c109263cab51b416fcc835ddd7eae"'
320337! stdout '"(Dir|Info|GoMod|Zip)"'
321338
322339# reuse the bulk results with all.json
340+ go clean -modcache
323341! 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
324342! stderr 'git( .*)* fetch'
325343stdout '"Reuse": true'
326344! stdout '"(Dir|Info|GoMod|Zip)"'
327345
328346# reuse attempt with stale hash should reinvoke git, not report reuse
347+ go clean -modcache
329348cp tagtestsv022.json tagtestsv022badhash.json
330349replace '57952' '56952XXX' tagtestsv022badhash.json
331350go mod download -reuse=tagtestsv022badhash.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
@@ -335,7 +354,7 @@ stdout '"Version": "v0.2.2"'
335354! stdout '"Query"'
336355stdout '"VCS": "git"'
337356stdout '"URL": ".*/git/tagtests"'
338- ! stdout '"(TagPrefix|TagSum)"'
357+ ! stdout '"(TagPrefix|TagSum|RepoSum )"'
339358stdout '"Ref": "refs/tags/v0.2.2"'
340359stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
341360stdout '"Dir"'
@@ -344,6 +363,7 @@ stdout '"GoMod"'
344363stdout '"Zip"'
345364
346365# reuse with stale repo URL
366+ go clean -modcache
347367cp tagtestsv022.json tagtestsv022badurl.json
348368replace 'git/tagtests\"' 'git/tagtestsXXX\"' tagtestsv022badurl.json
349369go mod download -reuse=tagtestsv022badurl.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
@@ -355,22 +375,107 @@ stdout '"GoMod"'
355375stdout '"Zip"'
356376
357377# reuse with stale VCS
378+ go clean -modcache
358379cp tagtestsv022.json tagtestsv022badvcs.json
359380replace '\"git\"' '\"gitXXX\"' tagtestsv022badvcs.json
360381go mod download -reuse=tagtestsv022badvcs.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
361382! stdout '"Reuse": true'
362383stdout '"URL": ".*/git/tagtests"'
384+ ! stdout '"RepoSum"'
363385
364386# reuse with stale Dir
387+ go clean -modcache
365388cp tagtestsv022.json tagtestsv022baddir.json
366389replace '\t\t\"Ref\":' '\t\t\"Subdir\": \"subdir\",\n\t\t\"Ref\":' tagtestsv022baddir.json
367390go mod download -reuse=tagtestsv022baddir.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2
368391! stdout '"Reuse": true'
369392stdout '"URL": ".*/git/tagtests"'
393+ ! stdout '"RepoSum"'
370394
371395# reuse with stale TagSum
396+ go clean -modcache
372397cp tagtests.json tagtestsbadtagsum.json
373398replace 'sMEOGo=' 'sMEoGo=XXX' tagtestsbadtagsum.json
374399go mod download -reuse=tagtestsbadtagsum.json -x -json vcs-test.golang.org/git/tagtests.git@latest
375400! stdout '"Reuse": true'
376401stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
402+ ! stdout '"RepoSum"'
403+
404+ # go list on repo with no tags
405+ go clean -modcache
406+ go list -x -json -m -retracted -versions vcs-test.golang.org/git/hello.git@latest
407+ stderr 'git( .*)* fetch'
408+ cp stdout hellolist.json
409+ ! stdout '"Versions"'
410+ stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
411+ stdout '"VCS": "git"'
412+ stdout '"URL": ".*/git/hello"'
413+ stdout '"Query": "latest"'
414+ ! stdout '"TagPrefix"'
415+ stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
416+ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
417+ ! stdout '"RepoSum"'
418+
419+ # reuse go list on repo with no tags
420+ go clean -modcache
421+ go list -x -reuse=hellolist.json -json -m -retracted -versions vcs-test.golang.org/git/hello.git@latest
422+ ! stderr 'git( .*)* fetch'
423+ stdout '"Reuse": true'
424+ ! stdout '"Versions"'
425+ stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"'
426+ stdout '"VCS": "git"'
427+ stdout '"URL": ".*/git/hello"'
428+ stdout '"Query": "latest"'
429+ ! stdout '"TagPrefix"'
430+ stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
431+ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"'
432+ ! stdout '"RepoSum"'
433+
434+ # reuse with stale list
435+ go clean -modcache
436+ cp hellolist.json hellolistbad.json
437+ replace '47DEQ' 'ZZZ' hellolistbad.json
438+ go clean -modcache
439+ go list -x -reuse=hellolistbad.json -json -m -retracted -versions vcs-test.golang.org/git/hello.git@latest
440+ stderr 'git( .*)* fetch'
441+ ! stdout '"Reuse": true'
442+ stdout '"TagSum": "t1:47DEQpj8HBSa[+]/TImW[+]5JCeuQeRkm5NMpJWZG3hSuFU="'
443+
444+ # go list on repo with tags
445+ go clean -modcache
446+ go list -x -json -m -retracted -versions vcs-test.golang.org/git/tagtests.git@latest
447+ cp stdout taglist.json
448+ stderr 'git( .*)* fetch'
449+ stdout '"Versions":'
450+ stdout '"v0.2.1"'
451+ stdout '"v0.2.2"'
452+ stdout '"Version": "v0.2.2"'
453+ stdout '"VCS": "git"'
454+ stdout '"URL": ".*/git/tagtests"'
455+ stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
456+ stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
457+ stdout '"Ref": "refs/tags/v0.2.2"'
458+
459+ # reuse go list on repo with tags
460+ go clean -modcache
461+ go list -reuse=taglist.json -x -json -m -retracted -versions vcs-test.golang.org/git/tagtests.git@latest
462+ ! stderr 'git( .*)* fetch'
463+ stdout '"Reuse": true'
464+ stdout '"Versions":'
465+ stdout '"v0.2.1"'
466+ stdout '"v0.2.2"'
467+ stdout '"Version": "v0.2.2"'
468+ stdout '"VCS": "git"'
469+ stdout '"URL": ".*/git/tagtests"'
470+ stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"'
471+ stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
472+ stdout '"Ref": "refs/tags/v0.2.2"'
473+
474+ # reuse with stale list
475+ go clean -modcache
476+ cp taglist.json taglistbad.json
477+ replace 'Dp7yRKDu' 'ZZZ' taglistbad.json
478+ go list -reuse=taglistbad.json -x -json -m -retracted -versions vcs-test.golang.org/git/tagtests.git@latest
479+ stderr 'git( .*)* fetch'
480+ ! stdout '"Reuse": true'
481+ stdout '"TagSum": "t1:Dp7yRKDuE8WjG0429PN9hYWjqhy2te7P9Oki/sMEOGo="'
0 commit comments