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

     1  # When converting a commit to a pseudo-version, don't use a retracted version
     2  # as the base.
     3  # Verifies golang.org/issue/41700.
     4  
     5  [short] skip
     6  [!git] skip
     7  env GOPROXY=direct
     8  env GOSUMDB=off
     9  go mod init m
    10  
    11  # Control: check that v1.0.0 is the only version and is retracted.
    12  go list -m -versions vcs-test.golang.org/git/retract-pseudo.git
    13  stdout '^vcs-test.golang.org/git/retract-pseudo.git$'
    14  go list -m -versions -retracted vcs-test.golang.org/git/retract-pseudo.git
    15  stdout '^vcs-test.golang.org/git/retract-pseudo.git v1.0.0$'
    16  
    17  # 713affd19d7b is a commit after v1.0.0. Don't use v1.0.0 as the base.
    18  go list -m vcs-test.golang.org/git/retract-pseudo.git@713affd19d7b
    19  stdout '^vcs-test.golang.org/git/retract-pseudo.git v0.0.0-20201009173747-713affd19d7b$'
    20  
    21  # 64c061ed4371 is the commit v1.0.0 refers to. Don't convert to v1.0.0.
    22  go list -m vcs-test.golang.org/git/retract-pseudo.git@64c061ed4371
    23  stdout '^vcs-test.golang.org/git/retract-pseudo.git v0.0.0-20201009173747-64c061ed4371'
    24  
    25  # A retracted version is a valid base. Retraction should not validate existing
    26  # pseudo-versions, nor should it turn invalid pseudo-versions valid.
    27  go get vcs-test.golang.org/git/retract-pseudo.git@v1.0.1-0.20201009173747-713affd19d7b
    28  go list -m vcs-test.golang.org/git/retract-pseudo.git
    29  stdout '^vcs-test.golang.org/git/retract-pseudo.git v1.0.1-0.20201009173747-713affd19d7b$'
    30  
    31  ! go get vcs-test.golang.org/git/retract-pseudo.git@v1.0.1-0.20201009173747-64c061ed4371
    32  stderr '^go: vcs-test.golang.org/git/retract-pseudo.git@v1.0.1-0.20201009173747-64c061ed4371: invalid pseudo-version: tag \(v1.0.0\) found on revision 64c061ed4371 is already canonical, so should not be replaced with a pseudo-version derived from that tag$'
    33  
    34  -- retract-pseudo.sh --
    35  #!/bin/bash
    36  
    37  # This is not part of the test.
    38  # Run this to generate and update the repository on vcs-test.golang.org.
    39  
    40  set -euo pipefail
    41  
    42  rm -rf retract-pseudo
    43  mkdir retract-pseudo
    44  cd retract-pseudo
    45  git init
    46  
    47  # Create the module.
    48  # Retract v1.0.0 and tag v1.0.0 at the same commit.
    49  # The module has no unretracted release versions.
    50  go mod init vcs-test.golang.org/git/retract-pseudo.git
    51  go mod edit -retract v1.0.0
    52  echo 'package p' >p.go
    53  git add -A
    54  git commit -m 'create module retract-pseudo'
    55  git tag v1.0.0
    56  
    57  # Commit a trivial change so the default branch does not point to v1.0.0.
    58  git mv p.go q.go
    59  git commit -m 'trivial change'
    60  
    61  zip -r ../retract-pseudo.zip .
    62  gsutil cp ../retract-pseudo.zip gs://vcs-test/git/retract-pseudo.zip
    63  

View as plain text