summaryrefslogtreecommitdiffstats
path: root/modules/git/repo_tree.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-09-05 18:42:58 +0200
committerGitHub <noreply@github.com>2020-09-05 12:42:58 -0400
commitbc11caff94896c8c3f9a5c970a77470ed9beb83a (patch)
tree75196365a23153cb7e9d13c368fa27d75b3aecfa /modules/git/repo_tree.go
parent9fdb4f887b65a6ddacefc8c7e4580e333d7e4b95 (diff)
downloadgitea-bc11caff94896c8c3f9a5c970a77470ed9beb83a.tar.gz
gitea-bc11caff94896c8c3f9a5c970a77470ed9beb83a.zip
[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>
Diffstat (limited to 'modules/git/repo_tree.go')
-rw-r--r--modules/git/repo_tree.go8
1 files changed, 3 insertions, 5 deletions
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")
}