aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/view.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-07-25 16:39:42 +0100
committerGitHub <noreply@github.com>2022-07-25 16:39:42 +0100
commita2cfcdb91a9098381bb1d71ebdf56baed4c0981d (patch)
tree43e1bf303236353fe339e33637764b82c5414954 /routers/web/repo/view.go
parent690272d2e24846390d785a1f053af6c7ba5963a3 (diff)
downloadgitea-a2cfcdb91a9098381bb1d71ebdf56baed4c0981d.tar.gz
gitea-a2cfcdb91a9098381bb1d71ebdf56baed4c0981d.zip
Slightly simplify LastCommitCache (#20444)
The LastCommitCache code is a little complex and there is unnecessary duplication between the gogit and nogogit variants. This PR adds the LastCommitCache as a field to the git.Repository and pre-creates it in the ReferencesGit helpers etc. There has been some simplification and unification of the variant code. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/web/repo/view.go')
-rw-r--r--routers/web/repo/view.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 6b6660f774..a396be8ae3 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -27,7 +27,6 @@ import (
unit_model "code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
- "code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/charset"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
@@ -812,11 +811,6 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri
defer cancel()
}
- var c *git.LastCommitCache
- if setting.CacheService.LastCommit.Enabled && ctx.Repo.CommitsCount >= setting.CacheService.LastCommit.CommitsCount {
- c = git.NewLastCommitCache(ctx.Repo.Repository.FullName(), ctx.Repo.GitRepo, setting.LastCommitCacheTTLSeconds, cache.GetCache())
- }
-
selected := map[string]bool{}
for _, pth := range ctx.FormStrings("f[]") {
selected[pth] = true
@@ -833,7 +827,7 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri
}
var latestCommit *git.Commit
- ctx.Data["Files"], latestCommit, err = entries.GetCommitsInfo(commitInfoCtx, ctx.Repo.Commit, ctx.Repo.TreePath, c)
+ ctx.Data["Files"], latestCommit, err = entries.GetCommitsInfo(commitInfoCtx, ctx.Repo.Commit, ctx.Repo.TreePath)
if err != nil {
ctx.ServerError("GetCommitsInfo", err)
return nil