localrepo: Use catfile cache in ReadObject
A localrepo already has access to the catfile cache, and ReadCommit()
already uses it to read objects. ReadObject()
still was spawning a
git-cat-file(1)
process itself.
This change modifies ReadObject() to use the catfile cache. This might
avoid actually spawning a new process. We verify this with the newly
introduced gittest.CountingCommandFactory
, and benchmark the effect
on FindLicense
.
The change is behind a feature flag rolled out through: #4662 (closed)
Edited by Toon Claes