aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/last_commit_cache_gogit.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-10-08 14:08:22 +0100
committerGitHub <noreply@github.com>2021-10-08 15:08:22 +0200
commit001dbf100de40f19c7ade5b8f013fbcccbe09ec3 (patch)
tree0b1a57f8efbb2e941fe4c344005a70ec76ad57d1 /modules/git/last_commit_cache_gogit.go
parent88fa9f3fb168bc6c9c2bdc6341b83bc048b38846 (diff)
downloadgitea-001dbf100de40f19c7ade5b8f013fbcccbe09ec3.tar.gz
gitea-001dbf100de40f19c7ade5b8f013fbcccbe09ec3.zip
Defer Last Commit Info (#16467)
One of the biggest reasons for slow repository browsing is that we wait until last commit information has been generated for all files in the repository. This PR proposes deferring this generation to a new POST endpoint that does the look up outside of the main page request. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/git/last_commit_cache_gogit.go')
-rw-r--r--modules/git/last_commit_cache_gogit.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/modules/git/last_commit_cache_gogit.go b/modules/git/last_commit_cache_gogit.go
index fb09af6f2a..b57e9ad11f 100644
--- a/modules/git/last_commit_cache_gogit.go
+++ b/modules/git/last_commit_cache_gogit.go
@@ -9,7 +9,6 @@ package git
import (
"context"
- "path"
"code.gitea.io/gitea/modules/log"
@@ -93,15 +92,12 @@ func (c *LastCommitCache) recursiveCache(ctx context.Context, index cgobject.Com
entryMap[entry.Name()] = entry
}
- commits, err := GetLastCommitForPaths(ctx, index, treePath, entryPaths)
+ commits, err := GetLastCommitForPaths(ctx, c, index, treePath, entryPaths)
if err != nil {
return err
}
- for entry, cm := range commits {
- if err := c.Put(index.ID().String(), path.Join(treePath, entry), cm.ID().String()); err != nil {
- return err
- }
+ for entry := range commits {
if entryMap[entry].IsDir() {
subTree, err := tree.SubTree(entry)
if err != nil {