...

Text file src/cmd/go/testdata/script/reuse_git.txt

Documentation: cmd/go/testdata/script

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

View as plain text