git/stats: Refactor code parsing git-count-objects(1) to use struct
The stats package contains code that parses git-count-objects(1)'s output into an unstructured map. This map is then used to provide multiple different bits of information like the object count or gets used to write a log message.
This information is more generally useful though. One usecase is to
precompute the current repository's shape in OptimizeRepository()
and
pass it around for use by our heuristics that determine whether things
need repacking or not. There is also additional information that's not
provided by Git, like whether repositories have bitmaps or not, that we
could easily compute here.
But the current design where we parse information into an unstructured map is holding us back: it is not discoverable, makes refactorings unsafe, and is simply not a great interface to use more generally.
Refactor the code into a new ObjectsInfo
structure instead to change
this. While it requires more intimacy with git-count-objects(1), this
seems like an acceptable tradeoff to make wider use of this interface in
the future.
Part of #4543 (closed).