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

     1  env GO111MODULE=on
     2  env GOPROXY=direct
     3  env 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  [!net] skip
    10  [!exec: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  
    20  go get vcs-test.golang.org/git/tagtests.git@master
    21  go list -m all
    22  stdout '^vcs-test.golang.org/git/tagtests.git v0.2.3-0\.'
    23  
    24  -- go.mod --
    25  module x
    26  
    27  go 1.12
    28  -- x.go --
    29  package x
    30  
    31  import _ "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  
    38  set -euo pipefail
    39  cd "$(dirname "$0")"
    40  rm -rf tagtests
    41  mkdir tagtests
    42  cd tagtests
    43  
    44  git init
    45  echo module vcs-test.golang.org/git/tagtests.git >go.mod
    46  echo package tagtests >tagtests.go
    47  git add go.mod tagtests.go
    48  git commit -m 'create module tagtests'
    49  
    50  git branch b
    51  
    52  echo v0.2.1 >v0.2.1
    53  git add v0.2.1
    54  git commit -m v0.2.1
    55  git tag v0.2.1
    56  
    57  git checkout b
    58  echo v0.2.2 >v0.2.2
    59  git add v0.2.2
    60  git commit -m v0.2.2
    61  git tag v0.2.2
    62  
    63  git checkout master
    64  git merge b -m merge
    65  
    66  zip -r ../tagtests.zip .
    67  gsutil cp ../tagtests.zip gs://vcs-test/git/tagtests.zip
    68  

View as plain text