[Vendor] Switch go-version lib (#12719)

* vendor: switch from "mcuadros/go-version" to "hashicorp/go-version"

* Adapt P1

* simplify

* fix lint

* adapt

* fix lint & rm old code

* no deadlock

* rm RWMutex and check GoVersion only 1-time

* Copyright header

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
6543 2020-09-05 18:42:58 +02:00 committed by GitHub
parent 9fdb4f887b
commit bc11caff94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1134 additions and 966 deletions

View file

@ -14,7 +14,6 @@ import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/mcuadros/go-version"
)
// GetRefCommitID returns the last commit ID string of given reference (branch or tag).
@ -470,7 +469,7 @@ func (repo *Repository) getCommitsBeforeLimit(id SHA1, num int) (*list.List, err
}
func (repo *Repository) getBranches(commit *Commit, limit int) ([]string, error) {
if version.Compare(gitVersion, "2.7.0", ">=") {
if CheckGitVersionConstraint(">= 2.7.0") == nil {
stdout, err := NewCommand("for-each-ref", "--count="+strconv.Itoa(limit), "--format=%(refname:strip=2)", "--contains", commit.ID.String(), BranchPrefix).RunInDir(repo.Path)
if err != nil {
return nil, err