aboutsummaryrefslogtreecommitdiff
path: root/odb.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-12 09:42:59 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-12 08:38:42 -0700
commit2b24db1110150138ac1e09bc60d9ae5245909625 (patch)
tree1661f7964868da60d42883b5ebb0376e8ea17bde /odb.h
parent222fddeaa44b633eea345996735b4f7893eb71ec (diff)
downloadgit-2b24db1110150138ac1e09bc60d9ae5245909625.tar.xz
object-file: generalize counting objects
Generalize the function introduced in the preceding commit to not only be able to approximate the number of loose objects, but to also provide an accurate count. The behaviour can be toggled via a new flag. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'odb.h')
-rw-r--r--odb.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/odb.h b/odb.h
index 7a583e3873..e6057477f6 100644
--- a/odb.h
+++ b/odb.h
@@ -500,6 +500,15 @@ int odb_for_each_object(struct object_database *odb,
void *cb_data,
unsigned flags);
+enum odb_count_objects_flags {
+ /*
+ * Instead of providing an accurate count, allow the number of objects
+ * to be approximated. Details of how this approximation works are
+ * subject to the specific source's implementation.
+ */
+ ODB_COUNT_OBJECTS_APPROXIMATE = (1 << 0),
+};
+
enum {
/*
* By default, `odb_write_object()` does not actually write anything