]> source.dussan.org Git - gitea.git/commit
Refactor the usage of batch catfile (#31754)
authorLunny Xiao <xiaolunwen@gmail.com>
Tue, 20 Aug 2024 17:04:57 +0000 (01:04 +0800)
committerGitHub <noreply@github.com>
Tue, 20 Aug 2024 17:04:57 +0000 (17:04 +0000)
commitc03baab678ba5b2e9d974aea147e660417f5d3f7
tree2b890d549a150cc1c9f6101218789601f40b960f
parent8b92eba21f5c5cca277b8101ada0ea7a1fb32ae0
Refactor the usage of batch catfile (#31754)

When opening a repository, it will call `ensureValidRepository` and also
`CatFileBatch`. But sometimes these will not be used until repository
closed. So it's a waste of CPU to invoke 3 times git command for every
open repository.

This PR removed all of these from `OpenRepository` but only kept
checking whether the folder exists. When a batch is necessary, the
necessary functions will be invoked.
15 files changed:
modules/git/batch.go [new file with mode: 0644]
modules/git/batch_reader.go
modules/git/blob_nogogit.go
modules/git/commit_info_nogogit.go
modules/git/pipeline/lfs_nogogit.go
modules/git/repo_base_nogogit.go
modules/git/repo_branch_nogogit.go
modules/git/repo_commit_nogogit.go
modules/git/repo_language_stats_nogogit.go
modules/git/repo_tag_nogogit.go
modules/git/repo_tree_nogogit.go
modules/git/tree_entry_nogogit.go
modules/git/tree_nogogit.go
modules/indexer/code/bleve/bleve.go
modules/indexer/code/elasticsearch/elasticsearch.go