...
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
7env GOPROXY=direct
8env GOSUMDB=off
9go mod init m
10
11# Control: check that v1.0.0 is the only version and is retracted.
12go list -m -versions vcs-test.golang.org/git/retract-pseudo.git
13stdout '^vcs-test.golang.org/git/retract-pseudo.git$'
14go list -m -versions -retracted vcs-test.golang.org/git/retract-pseudo.git
15stdout '^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.
18go list -m vcs-test.golang.org/git/retract-pseudo.git@713affd19d7b
19stdout '^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.
22go list -m vcs-test.golang.org/git/retract-pseudo.git@64c061ed4371
23stdout '^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.
27go get vcs-test.golang.org/git/retract-pseudo.git@v1.0.1-0.20201009173747-713affd19d7b
28go list -m vcs-test.golang.org/git/retract-pseudo.git
29stdout '^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
32stderr '^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
40set -euo pipefail
41
42rm -rf retract-pseudo
43mkdir retract-pseudo
44cd retract-pseudo
45git 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.
50go mod init vcs-test.golang.org/git/retract-pseudo.git
51go mod edit -retract v1.0.0
52echo 'package p' >p.go
53git add -A
54git commit -m 'create module retract-pseudo'
55git tag v1.0.0
56
57# Commit a trivial change so the default branch does not point to v1.0.0.
58git mv p.go q.go
59git commit -m 'trivial change'
60
61zip -r ../retract-pseudo.zip .
62gsutil cp ../retract-pseudo.zip gs://vcs-test/git/retract-pseudo.zip
View as plain text