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 /modules/repository | |
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 'modules/repository')
-rw-r--r-- | modules/repository/init.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/repository/init.go b/modules/repository/init.go index 8c8827c511..c2038e18d4 100644 --- a/modules/repository/init.go +++ b/modules/repository/init.go @@ -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") } } |