diff options
author | 6543 <6543@obermui.de> | 2020-09-05 18:42:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-05 12:42:58 -0400 |
commit | bc11caff94896c8c3f9a5c970a77470ed9beb83a (patch) | |
tree | 75196365a23153cb7e9d13c368fa27d75b3aecfa /services/pull/merge.go | |
parent | 9fdb4f887b65a6ddacefc8c7e4580e333d7e4b95 (diff) | |
download | gitea-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 'services/pull/merge.go')
-rw-r--r-- | services/pull/merge.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/services/pull/merge.go b/services/pull/merge.go index 27689384a5..b430a9080e 100644 --- a/services/pull/merge.go +++ b/services/pull/merge.go @@ -25,8 +25,6 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" issue_service "code.gitea.io/gitea/services/issue" - - "github.com/mcuadros/go-version" ) // Merge merges pull request to base repository. @@ -113,9 +111,9 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor // rawMerge perform the merge operation without changing any pull information in database func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.MergeStyle, message string) (string, error) { - binVersion, err := git.BinVersion() + err := git.LoadGitVersion() if err != nil { - log.Error("git.BinVersion: %v", err) + log.Error("git.LoadGitVersion: %v", err) return "", fmt.Errorf("Unable to get git version: %v", err) } @@ -157,7 +155,7 @@ func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.Merge } var gitConfigCommand func() *git.Command - if version.Compare(binVersion, "1.8.0", ">=") { + if git.CheckGitVersionConstraint(">= 1.8.0") == nil { gitConfigCommand = func() *git.Command { return git.NewCommand("config", "--local") } @@ -213,11 +211,11 @@ func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.Merge // Determine if we should sign signArg := "" - if version.Compare(binVersion, "1.7.9", ">=") { + if git.CheckGitVersionConstraint(">= 1.7.9") == nil { sign, keyID, _ := pr.SignMerge(doer, tmpBasePath, "HEAD", trackingBranch) if sign { signArg = "-S" + keyID - } else if version.Compare(binVersion, "2.0.0", ">=") { + } else if git.CheckGitVersionConstraint(">= 2.0.0") == nil { signArg = "--no-gpg-sign" } } |