aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_pseudo_prefix.txt
blob: b78e6e644f7622a3d22dd4333672c7f3731dcf48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
env GO111MODULE=on
env GOPROXY=direct
env GOSUMDB=off

# Testing that a pseudo-version is based on the semantically-latest
# prefixed tag in any commit that is a parent of the commit supplied
# to 'go get', when using a repo with go.mod in a sub directory.

[!net] skip
[!exec:git] skip

# For this test repository go.mod resides in sub/ (only):
#  master is not tagged
#  tag v0.2.0 is most recent tag before master
#  tag sub/v0.0.10 is most recent tag before v0.2.0
#
# The pseudo-version is based on sub/v0.0.10, since v0.2.0 doesn't
# contain the prefix.
go get -d vcs-test.golang.org/git/prefixtagtests.git/sub
go list -m all
stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.10$'

go get -d -u vcs-test.golang.org/git/prefixtagtests.git/sub@master
go list -m all
stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.11-0\.'

-- go.mod --
module x

go 1.12
-- x.go --
package x

import _ "vcs-test.golang.org/prefixtagtests.git/sub"
-- gen_prefixtagtests.sh --
#!/bin/bash

# This is not part of the test.
# Run this to generate and update the repository on vcs-test.golang.org.

set -euo pipefail
cd "$(dirname "$0")"
rm -rf prefixtagtests
mkdir prefixtagtests
cd prefixtagtests

git init
mkdir sub
echo module vcs-test.golang.org/git/prefixtagtests.git/sub >sub/go.mod
echo package sub >sub/sub.go
git add sub
git commit -m 'create module sub'
for i in v0.1.0 sub/v0.0.9 sub/v0.0.10 v0.2.0; do
  echo $i >status
  git add status
  git commit -m $i
  git tag $i
done
echo 'after last tag' >status
git add status
git commit -m 'after last tag'

zip -r ../prefixtagtests.zip .
gsutil cp ../prefixtagtests.zip gs://vcs-test/git/prefixtagtests.zip