mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 08:48:37 +00:00
Avoid creating unnecessary temporary cat file sub process (#33942)
Extract from #33934 In the same goroutine, we should reuse the exist cat file sub process which exist in `git.Repository` to avoid creating a unnecessary temporary subprocess. This PR reuse the exist cate file writer and reader in `getCommitFromBatchReader`. It also move `prepareLatestCommitInfo` before creating dataRc which will hold the writer so other git operation will create a temporary cat file subprocess.
This commit is contained in:
@@ -35,7 +35,11 @@ func (repo *Repository) getTree(id ObjectID) (*Tree, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commit, err := tag.Commit(repo)
|
||||
|
||||
if _, err := wr.Write([]byte(tag.Object.String() + "\n")); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commit, err := repo.getCommitFromBatchReader(wr, rd, tag.Object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user