forked from kevadesu/forgejo
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:
parent
e673e42f7e
commit
e3c626834b
17 changed files with 113 additions and 92 deletions
|
@ -143,8 +143,8 @@ func GetAllCommits(ctx *context.APIContext) {
|
|||
listOptions.Page = 1
|
||||
}
|
||||
|
||||
if listOptions.PageSize > git.CommitsRangeSize {
|
||||
listOptions.PageSize = git.CommitsRangeSize
|
||||
if listOptions.PageSize > setting.Git.CommitsRangeSize {
|
||||
listOptions.PageSize = setting.Git.CommitsRangeSize
|
||||
}
|
||||
|
||||
sha := ctx.Query("sha")
|
||||
|
|
|
@ -69,7 +69,9 @@ func GlobalInit(ctx context.Context) {
|
|||
if err := git.Init(ctx); err != nil {
|
||||
log.Fatal("Git module init failed: %v", err)
|
||||
}
|
||||
setting.CheckLFSVersion()
|
||||
log.Info(git.VersionInfo())
|
||||
|
||||
git.CheckLFSVersion()
|
||||
log.Trace("AppPath: %s", setting.AppPath)
|
||||
log.Trace("AppWorkPath: %s", setting.AppWorkPath)
|
||||
log.Trace("Custom path: %s", setting.CustomPath)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ func Commits(ctx *context.Context) {
|
|||
|
||||
pageSize := ctx.QueryInt("limit")
|
||||
if pageSize <= 0 {
|
||||
pageSize = git.CommitsRangeSize
|
||||
pageSize = setting.Git.CommitsRangeSize
|
||||
}
|
||||
|
||||
// Both `git log branchName` and `git log commitId` work.
|
||||
|
@ -82,7 +82,7 @@ func Commits(ctx *context.Context) {
|
|||
ctx.Data["CommitCount"] = commitsCount
|
||||
ctx.Data["Branch"] = ctx.Repo.BranchName
|
||||
|
||||
pager := context.NewPagination(int(commitsCount), git.CommitsRangeSize, page, 5)
|
||||
pager := context.NewPagination(int(commitsCount), setting.Git.CommitsRangeSize, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
|
@ -250,7 +250,7 @@ func FileHistory(ctx *context.Context) {
|
|||
ctx.Data["CommitCount"] = commitsCount
|
||||
ctx.Data["Branch"] = branchName
|
||||
|
||||
pager := context.NewPagination(int(commitsCount), git.CommitsRangeSize, page, 5)
|
||||
pager := context.NewPagination(int(commitsCount), setting.Git.CommitsRangeSize, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
|
@ -316,7 +317,7 @@ func renderRevisionPage(ctx *context.Context) (*git.Repository, *git.TreeEntry)
|
|||
|
||||
ctx.Data["Commits"] = commitsHistory
|
||||
|
||||
pager := context.NewPagination(int(commitsCount), git.CommitsRangeSize, page, 5)
|
||||
pager := context.NewPagination(int(commitsCount), setting.Git.CommitsRangeSize, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue