diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/mirror/mirror.go | 5 | ||||
-rw-r--r-- | services/pull/merge.go | 12 |
2 files changed, 7 insertions, 10 deletions
diff --git a/services/mirror/mirror.go b/services/mirror/mirror.go index 75054b690f..da794ea585 100644 --- a/services/mirror/mirror.go +++ b/services/mirror/mirror.go @@ -23,7 +23,6 @@ import ( "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" - "github.com/mcuadros/go-version" "github.com/unknwon/com" ) @@ -43,11 +42,11 @@ func readAddress(m *models.Mirror) { func remoteAddress(repoPath string) (string, error) { var cmd *git.Command - binVersion, err := git.BinVersion() + err := git.LoadGitVersion() if err != nil { return "", err } - if version.Compare(binVersion, "2.7", ">=") { + if git.CheckGitVersionConstraint(">= 2.7") == nil { cmd = git.NewCommand("remote", "get-url", "origin") } else { cmd = git.NewCommand("config", "--get", "remote.origin.url") 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" } } |