env GO111MODULE=on

[!git] skip
[short] skip

# Testing git->module converter's generation of +incompatible tags; turn off proxy.
env GOPROXY=direct
env GOSUMDB=off

# We can resolve the @master branch without unshallowing the local repository
# (even with older gits), so try that before we do anything else.
# (This replicates https://golang.org/issue/26713 with git 2.7.4.)
go get vcs-test.golang.org/git/legacytest.git@master
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$'

# get should include incompatible tags in "latest" calculation.
go mod edit -droprequire vcs-test.golang.org/git/legacytest.git
go get vcs-test.golang.org/git/legacytest.git@latest
go list
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v2\.0\.0\+incompatible$'

# v2.0.1-0.pseudo+incompatible
go get ...test.git@7303f77
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$'

# v2.0.0+incompatible by tag+incompatible
go get ...test.git@v2.0.0+incompatible
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v2\.0\.0\+incompatible$'

# v2.0.0+incompatible by tag
go get ...test.git@v2.0.0
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v2\.0\.0\+incompatible$'

# v2.0.0+incompatible by hash (back on master)
go get ...test.git@d7ae1e4
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v2\.0\.0\+incompatible$'

# v1.2.1-0.pseudo
go get ...test.git@d2d4c3e
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v1\.2\.1-0\.\d{14}-d2d4c3ea6623$'

# v1.2.0
go get ...test.git@9f6f860
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v1\.2\.0$'

# v1.1.0-pre.0.pseudo
go get ...test.git@fb3c628
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v1\.1\.0-pre\.0\.\d{14}-fb3c628075e3$'

# v1.1.0-pre (no longer on master)
go get ...test.git@731e3b1
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v1\.1\.0-pre$'

# v1.0.1-0.pseudo
go get ...test.git@fa4f5d6
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v1\.0\.1-0\.\d{14}-fa4f5d6a71c6$'

# v1.0.0
go get ...test.git@7fff7f3
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v1\.0\.0$'

# v0.0.0-pseudo
go get ...test.git@52853eb
go list -m all
stdout '^vcs-test.golang.org/git/legacytest.git v0\.0\.0-\d{14}-52853eb7b552$'

-- go.mod --
module x
-- x.go --
package x
import "vcs-test.golang.org/git/legacytest.git"
