Let package git depend on setting but not opposite (#15241)

* Let package git depend on setting but not opposite

* private some package variables
This commit is contained in:
Lunny Xiao 2021-06-26 19:28:55 +08:00 committed by GitHub
parent e673e42f7e
commit e3c626834b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 113 additions and 92 deletions

View file

@ -18,6 +18,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/repofiles"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/utils"
@ -62,8 +63,8 @@ func Branches(ctx *context.Context) {
}
limit := ctx.QueryInt("limit")
if limit <= 0 || limit > git.BranchesRangeSize {
limit = git.BranchesRangeSize
if limit <= 0 || limit > setting.Git.BranchesRangeSize {
limit = setting.Git.BranchesRangeSize
}
skip := (page - 1) * limit
@ -73,7 +74,7 @@ func Branches(ctx *context.Context) {
return
}
ctx.Data["Branches"] = branches
pager := context.NewPagination(int(branchesCount), git.BranchesRangeSize, page, 5)
pager := context.NewPagination(int(branchesCount), setting.Git.BranchesRangeSize, page, 5)
pager.SetDefaultParams(ctx)
ctx.Data["Page"] = pager