blob: eb00e8405c01073740f44c1d769647324182b092 [file] [log] [blame]
# When converting a commit to a pseudo-version, don't use a retracted version
# as the base.
# Verifies
[!net] skip
[!exec:git] skip
env GOPROXY=direct
env GOSUMDB=off
go mod init m
# Control: check that v1.0.0 is the only version and is retracted.
go list -m -versions
stdout '^$'
go list -m -versions -retracted
stdout '^ v1.0.0$'
# 713affd19d7b is a commit after v1.0.0. Don't use v1.0.0 as the base.
go list -m
stdout '^ v0.0.0-20201009173747-713affd19d7b$'
# 64c061ed4371 is the commit v1.0.0 refers to. Don't convert to v1.0.0.
go list -m
stdout '^ v0.0.0-20201009173747-64c061ed4371'
# A retracted version is a valid base. Retraction should not validate existing
# pseudo-versions, nor should it turn invalid pseudo-versions valid.
go get -d
go list -m
stdout '^ v1.0.1-0.20201009173747-713affd19d7b$'
! go get -d
stderr '^go get: 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$'
-- --
# This is not part of the test.
# Run this to generate and update the repository on
set -euo pipefail
rm -rf retract-pseudo
mkdir retract-pseudo
cd retract-pseudo
git init
# Create the module.
# Retract v1.0.0 and tag v1.0.0 at the same commit.
# The module has no unretracted release versions.
go mod init
go mod edit -retract v1.0.0
echo 'package p' >p.go
git add -A
git commit -m 'create module retract-pseudo'
git tag v1.0.0
# Commit a trivial change so the default branch does not point to v1.0.0.
git mv p.go q.go
git commit -m 'trivial change'
zip -r ../ .
gsutil cp ../ gs://vcs-test/git/