From bc11caff94896c8c3f9a5c970a77470ed9beb83a Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 5 Sep 2020 18:42:58 +0200 Subject: [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 --- modules/git/repo_tree.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'modules/git/repo_tree.go') diff --git a/modules/git/repo_tree.go b/modules/git/repo_tree.go index 8f91f4efac..a662aaab4f 100644 --- a/modules/git/repo_tree.go +++ b/modules/git/repo_tree.go @@ -11,8 +11,6 @@ import ( "os" "strings" "time" - - "github.com/mcuadros/go-version" ) func (repo *Repository) getTree(id SHA1) (*Tree, error) { @@ -65,7 +63,7 @@ type CommitTreeOpts struct { // CommitTree creates a commit from a given tree id for the user with provided message func (repo *Repository) CommitTree(sig *Signature, tree *Tree, opts CommitTreeOpts) (SHA1, error) { - binVersion, err := BinVersion() + err := LoadGitVersion() if err != nil { return SHA1{}, err } @@ -91,11 +89,11 @@ func (repo *Repository) CommitTree(sig *Signature, tree *Tree, opts CommitTreeOp _, _ = messageBytes.WriteString(opts.Message) _, _ = messageBytes.WriteString("\n") - if version.Compare(binVersion, "1.7.9", ">=") && (opts.KeyID != "" || opts.AlwaysSign) { + if CheckGitVersionConstraint(">= 1.7.9") == nil && (opts.KeyID != "" || opts.AlwaysSign) { cmd.AddArguments(fmt.Sprintf("-S%s", opts.KeyID)) } - if version.Compare(binVersion, "2.0.0", ">=") && opts.NoGPGSign { + if CheckGitVersionConstraint(">= 2.0.0") == nil && opts.NoGPGSign { cmd.AddArguments("--no-gpg-sign") } -- cgit v1.2.3