...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2env GOPROXY=direct
     3env GOSUMDB=off
     4
     5# Testing that a pseudo-version is based on the semantically-latest
     6# tag that appears in any commit that is a (transitive) parent of the commit
     7# supplied to 'go get', regardless of branches
     8
     9[short] skip
    10[!git] skip
    11
    12# For this test repository:
    13#  tag v0.2.1 is most recent tag on master itself
    14#  tag v0.2.2 is on branch2, which was then merged to master
    15#  master is a merge commit with both tags as parents
    16#
    17# The pseudo-version hence sorts immediately after v0.2.2 rather
    18# than v0.2.1, even though the v0.2.2 tag is not on master.
    19
    20go get vcs-test.golang.org/git/tagtests.git@master
    21go list -m all
    22stdout '^vcs-test.golang.org/git/tagtests.git v0.2.3-0\.'
    23
    24-- go.mod --
    25module x
    26
    27go 1.12
    28-- x.go --
    29package x
    30
    31import _ "vcs-test.golang.org/git/tagtests.git"
    32-- gen_testtags.sh --
    33#!/bin/bash
    34
    35# This is not part of the test.
    36# Run this to generate and update the repository on vcs-test.golang.org.
    37
    38set -euo pipefail
    39cd "$(dirname "$0")"
    40rm -rf tagtests
    41mkdir tagtests
    42cd tagtests
    43
    44git init
    45echo module vcs-test.golang.org/git/tagtests.git >go.mod
    46echo package tagtests >tagtests.go
    47git add go.mod tagtests.go
    48git commit -m 'create module tagtests'
    49
    50git branch b
    51
    52echo v0.2.1 >v0.2.1
    53git add v0.2.1
    54git commit -m v0.2.1
    55git tag v0.2.1
    56
    57git checkout b
    58echo v0.2.2 >v0.2.2
    59git add v0.2.2
    60git commit -m v0.2.2
    61git tag v0.2.2
    62
    63git checkout master
    64git merge b -m merge
    65
    66zip -r ../tagtests.zip .
    67gsutil cp ../tagtests.zip gs://vcs-test/git/tagtests.zip

View as plain text