summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-06-26 19:28:55 +0800
committerGitHub <noreply@github.com>2021-06-26 13:28:55 +0200
commite3c626834b34fae7728ee7869ed73ee4d1b26a26 (patch)
treeec61ea5376286a78622b95b7d849e8a299c85a28 /routers
parente673e42f7efafb184ffbe84f6998087713d8e373 (diff)
downloadgitea-e3c626834b34fae7728ee7869ed73ee4d1b26a26.tar.gz
gitea-e3c626834b34fae7728ee7869ed73ee4d1b26a26.zip
Let package git depend on setting but not opposite (#15241)
* Let package git depend on setting but not opposite * private some package variables
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/commits.go4
-rw-r--r--routers/init.go4
-rw-r--r--routers/web/repo/branch.go7
-rw-r--r--routers/web/repo/commit.go6
-rw-r--r--routers/web/repo/wiki.go3
5 files changed, 14 insertions, 10 deletions
diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go
index a16cca0f4e..9a0fd1d0b6 100644
--- a/routers/api/v1/repo/commits.go
+++ b/routers/api/v1/repo/commits.go
@@ -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")
diff --git a/routers/init.go b/routers/init.go
index e52e547517..cc9f703214 100644
--- a/routers/init.go
+++ b/routers/init.go
@@ -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)
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go
index 4625b1a272..da72940144 100644
--- a/routers/web/repo/branch.go
+++ b/routers/web/repo/branch.go
@@ -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
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go
index 3e6148bcbb..45ef22f498 100644
--- a/routers/web/repo/commit.go
+++ b/routers/web/repo/commit.go
@@ -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
diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go
index cceb8451e5..5271fe9b4a 100644
--- a/routers/web/repo/wiki.go
+++ b/routers/web/repo/wiki.go
@@ -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