summaryrefslogtreecommitdiffstats
path: root/modules/git/commit_info_nogogit.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-05-02 02:16:08 +0100
committerGitHub <noreply@github.com>2021-05-02 03:16:08 +0200
commita926ff919db105f7ceed63bb858b6b80d96157dc (patch)
tree417fd759f635b89d7299e44a5b904af77cd0d972 /modules/git/commit_info_nogogit.go
parentfda2e4549fcfb4a08977c91520be44d6e4442f26 (diff)
downloadgitea-a926ff919db105f7ceed63bb858b6b80d96157dc.tar.gz
gitea-a926ff919db105f7ceed63bb858b6b80d96157dc.zip
Performance improvement for last commit cache and show-ref (#15455)
* Improve performance when there are multiple commits in the last commit cache * read refs directly if we can Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/git/commit_info_nogogit.go')
-rw-r--r--modules/git/commit_info_nogogit.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/git/commit_info_nogogit.go b/modules/git/commit_info_nogogit.go
index f14b7b8291..6dd7b11ba7 100644
--- a/modules/git/commit_info_nogogit.go
+++ b/modules/git/commit_info_nogogit.go
@@ -102,10 +102,13 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string, cache *LastCo
}
func getLastCommitForPathsByCache(commitID, treePath string, paths []string, cache *LastCommitCache) (map[string]*Commit, []string, error) {
+ wr, rd, cancel := CatFileBatch(cache.repo.Path)
+ defer cancel()
+
var unHitEntryPaths []string
var results = make(map[string]*Commit)
for _, p := range paths {
- lastCommit, err := cache.Get(commitID, path.Join(treePath, p))
+ lastCommit, err := cache.Get(commitID, path.Join(treePath, p), wr, rd)
if err != nil {
return nil, nil, err
}