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

     1  # Regression test for https://go.dev/issue/53955.
     2  # New remote tags were erroneously added to the local clone of a repo
     3  # only *after* extracting version information for a locally-cached commit,
     4  # causing the version information to have incomplete Tags and Version fields.
     5  
     6  [short] skip 'constructs a local git repo'
     7  [!git] skip
     8  [!net:github.com] skip 'does not actually use github.com because of insteadOf, but silence network check just in case'
     9  
    10  # Redirect git to a test-specific .gitconfig.
    11  # GIT_CONFIG_GLOBAL suffices for git 2.32.0 and newer.
    12  # For older git versions we also set $HOME.
    13  env GIT_CONFIG_GLOBAL=$WORK${/}home${/}gopher${/}.gitconfig
    14  env HOME=$WORK${/}home${/}gopher
    15  exec git config --global --show-origin user.name
    16  stdout 'Go Gopher'
    17  
    18  # Inject a local repo in place of a remote one, so that we can
    19  # add commits to the repo partway through the test.
    20  env GIT_ALLOW_PROTOCOL=file
    21  env GOPRIVATE=github.com/golang/issue53955
    22  
    23  [!GOOS:windows] exec git config --global 'url.file://'$WORK'/repo.insteadOf' 'https://github.com/golang/issue53955'
    24  [GOOS:windows]  exec git config --global 'url.file:///'$WORK'/repo.insteadOf' 'https://github.com/golang/issue53955'
    25  
    26  cd $WORK/repo
    27  
    28  env GIT_AUTHOR_NAME='Go Gopher'
    29  env GIT_AUTHOR_EMAIL='gopher@golang.org'
    30  env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
    31  env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
    32  
    33  exec git init
    34  
    35  env GIT_COMMITTER_DATE=2022-07-19T11:07:00-04:00
    36  env GIT_AUTHOR_DATE=2022-07-19T11:07:00-04:00
    37  exec git add go.mod issue53955.go
    38  exec git commit -m 'initial commit'
    39  exec git branch -m main
    40  exec git tag v1.0.9
    41  
    42  env GIT_COMMITTER_DATE=2022-07-19T11:07:01-04:00
    43  env GIT_AUTHOR_DATE=2022-07-19T11:07:01-04:00
    44  exec git add extra.go
    45  exec git commit -m 'next commit'
    46  exec git show-ref --tags --heads
    47  cmp stdout $WORK/.git-refs-1
    48  
    49  cd $WORK/m
    50  go get -x github.com/golang/issue53955@2cb3d49f
    51  stderr '^go: added github.com/golang/issue53955 v1.0.10-0.20220719150701-2cb3d49f8874$'
    52  
    53  cd $WORK/repo
    54  exec git tag v1.0.10
    55  
    56  cd $WORK/m
    57  go get -x github.com/golang/issue53955@v1.0.10
    58  ! stderr 'v1\.0\.10 is not a tag'
    59  stderr '^go: upgraded github.com/golang/issue53955 v.* => v1\.0\.10$'
    60  
    61  -- $WORK/repo/go.mod --
    62  module github.com/golang/issue53955
    63  
    64  go 1.18
    65  -- $WORK/repo/issue53955.go --
    66  package issue53955
    67  -- $WORK/repo/extra.go --
    68  package issue53955
    69  -- $WORK/.git-refs-1 --
    70  2cb3d49f8874b9362ed0ddd2a6512e4108bbf6b1 refs/heads/main
    71  050526ebf5883191e990529eb3cc9345abaf838c refs/tags/v1.0.9
    72  -- $WORK/m/go.mod --
    73  module m
    74  
    75  go 1.18
    76  -- $WORK/home/gopher/.gitconfig --
    77  [user]
    78  	name = Go Gopher
    79  	email = gopher@golang.org
    80  

View as plain text