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 /routers | |
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 'routers')
-rw-r--r-- | routers/admin/admin.go | 4 | ||||
-rw-r--r-- | routers/repo/lfs.go | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go index f43c1e69c5..5dbc321e9d 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -243,7 +243,9 @@ func Config(ctx *context.Context) { ctx.Data["DisableRouterLog"] = setting.DisableRouterLog ctx.Data["RunUser"] = setting.RunUser ctx.Data["RunMode"] = strings.Title(macaron.Env) - ctx.Data["GitVersion"], _ = git.BinVersion() + if version, err := git.LocalVersion(); err == nil { + ctx.Data["GitVersion"] = version.Original() + } ctx.Data["RepoRootPath"] = setting.RepoRootPath ctx.Data["CustomRootPath"] = setting.CustomPath ctx.Data["StaticRootPath"] = setting.StaticRootPath diff --git a/routers/repo/lfs.go b/routers/repo/lfs.go index 8aff89dd6a..4caf01adfd 100644 --- a/routers/repo/lfs.go +++ b/routers/repo/lfs.go @@ -33,7 +33,6 @@ import ( gogit "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" - "github.com/mcuadros/go-version" "github.com/unknwon/com" ) @@ -541,7 +540,7 @@ func LFSPointerFiles(ctx *context.Context) { return } ctx.Data["PageIsSettingsLFS"] = true - binVersion, err := git.BinVersion() + err := git.LoadGitVersion() if err != nil { log.Fatal("Error retrieving git version: %v", err) } @@ -586,7 +585,7 @@ func LFSPointerFiles(ctx *context.Context) { go createPointerResultsFromCatFileBatch(catFileBatchReader, &wg, pointerChan, ctx.Repo.Repository, ctx.User) go pipeline.CatFileBatch(shasToBatchReader, catFileBatchWriter, &wg, basePath) go pipeline.BlobsLessThan1024FromCatFileBatchCheck(catFileCheckReader, shasToBatchWriter, &wg) - if !version.Compare(binVersion, "2.6.0", ">=") { + if git.CheckGitVersionConstraint(">= 2.6.0") != nil { revListReader, revListWriter := io.Pipe() shasToCheckReader, shasToCheckWriter := io.Pipe() wg.Add(2) |