]> git.ipfire.org Git - thirdparty/git.git/commit
object-file: extract logic to approximate object count
authorPatrick Steinhardt <ps@pks.im>
Thu, 12 Mar 2026 08:42:58 +0000 (09:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Mar 2026 15:38:42 +0000 (08:38 -0700)
commit222fddeaa44b633eea345996735b4f7893eb71ec
tree27baa462f10c8b3531ad378daaef92acdee7ac31
parentdd587cd59e1575f2d5698cb45b42644e1df9b835
object-file: extract logic to approximate object count

In "builtin/gc.c" we have some logic that checks whether we need to
repack objects. This is done by counting the number of objects that we
have and checking whether it exceeds a certain threshold. We don't
really need an accurate object count though, which is why we only
open a single object directory shard and then extrapolate from there.

Extract this logic into a new function that is owned by the loose object
database source. This is done to prepare for a subsequent change, where
we'll introduce object counting on the object database source level.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
object-file.c
object-file.h