mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-18 17:00:02 +02:00
[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:
parent
9fdb4f887b
commit
bc11caff94
35 changed files with 1134 additions and 966 deletions
|
@ -19,7 +19,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"github.com/mcuadros/go-version"
|
||||
"github.com/unknwon/com"
|
||||
)
|
||||
|
||||
|
@ -122,7 +121,7 @@ func initRepoCommit(tmpPath string, repo *models.Repository, u *models.User, def
|
|||
return fmt.Errorf("git add --all: %v", err)
|
||||
}
|
||||
|
||||
binVersion, err := git.BinVersion()
|
||||
err = git.LoadGitVersion()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get git version: %v", err)
|
||||
}
|
||||
|
@ -132,11 +131,11 @@ func initRepoCommit(tmpPath string, repo *models.Repository, u *models.User, def
|
|||
"-m", "Initial commit",
|
||||
}
|
||||
|
||||
if version.Compare(binVersion, "1.7.9", ">=") {
|
||||
if git.CheckGitVersionConstraint(">= 1.7.9") == nil {
|
||||
sign, keyID, _ := models.SignInitialCommit(tmpPath, u)
|
||||
if sign {
|
||||
args = append(args, "-S"+keyID)
|
||||
} else if version.Compare(binVersion, "2.0.0", ">=") {
|
||||
} else if git.CheckGitVersionConstraint(">= 2.0.0") == nil {
|
||||
args = append(args, "--no-gpg-sign")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue