aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt
blob: 0fbd041f8603fd57a3b94e09008072431a56e285 (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
65
66
67
env GO111MODULE=on
env GOPROXY=direct
env GOSUMDB=off

# Testing that a pseudo-version is based on the semantically-latest
# tag that appears in any commit that is a (transitive) parent of the commit
# supplied to 'go get', regardless of branches

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

# For this test repository:
#  tag v0.2.1 is most recent tag on master itself
#  tag v0.2.2 is on branch2, which was then merged to master
#  master is a merge commit with both tags as parents
#
# The pseudo-version hence sorts immediately after v0.2.2 rather
# than v0.2.1, even though the v0.2.2 tag is not on master.

go get -d vcs-test.golang.org/git/tagtests.git@master
go list -m all
stdout '^vcs-test.golang.org/git/tagtests.git v0.2.3-0\.'

-- go.mod --
module x

go 1.12
-- x.go --
package x

import _ "vcs-test.golang.org/git/tagtests.git"
-- gen_testtags.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 tagtests
mkdir tagtests
cd tagtests

git init
echo module vcs-test.golang.org/git/tagtests.git >go.mod
echo package tagtests >tagtests.go
git add go.mod tagtests.go
git commit -m 'create module tagtests'

git branch b

echo v0.2.1 >v0.2.1
git add v0.2.1
git commit -m v0.2.1
git tag v0.2.1

git checkout b
echo v0.2.2 >v0.2.2
git add v0.2.2
git commit -m v0.2.2
git tag v0.2.2

git checkout master
git merge b -m merge

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