Refactor cat-file batch operations and support --batch-command approach (#35775)

Replace #34651 and address more problems including fix framework bugs and changing to QueryInfo and QueryContent calls.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
wxiaoguangandLunny Xiao authored and GitHub committed 2026-01-08 13:37:36 -08:00
1 parent ee9d8893a7
commit e226720cff
34 files changed
+832 -812

No files matched your search

+3 -7
View File
@@ -15,23 +15,19 @@ func (te *TreeEntry) Size() int64 {
return te.size
}
batch, cancel, err := te.ptree.repo.CatFileBatchCheck(te.ptree.repo.Ctx)
batch, cancel, err := te.ptree.repo.CatFileBatch(te.ptree.repo.Ctx)
if err != nil {
log.Debug("error whilst reading size for %s in %s. Error: %v", te.ID.String(), te.ptree.repo.Path, err)
return 0
}
defer cancel()
_, err = batch.Writer().Write([]byte(te.ID.String() + "\n"))
if err != nil {
log.Debug("error whilst reading size for %s in %s. Error: %v", te.ID.String(), te.ptree.repo.Path, err)
return 0
}
_, _, te.size, err = ReadBatchLine(batch.Reader())
info, err := batch.QueryInfo(te.ID.String())
if err != nil {
log.Debug("error whilst reading size for %s in %s. Error: %v", te.ID.String(), te.ptree.repo.Path, err)
return 0
}
te.size = info.Size
te.sized = true
return te.size
}