[PATCH 00/18] odb: make loose object source a proper `struct odb_source`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- May 21, 2026, 08:22 UTC
- Message-ID
- <20260521-b4-pks-odb-source-loose-v1-0-6553b399be2d@pks.im>
Hi,
this patch series converts the loose object source into a proper `struct odb_source` so that it can be used via our generic interfaces.
The patch series is relatively straight-forward, as the source basically already exists as such and the interfaces already match. So for most of the part we are just moving around some code and converting functions that were previously called directly into callbacks.
I guess the only part that needs some attention is that there is some confusion at first with the `struct odb_source_loose::source` parent pointer that initially points at the owning `struct odb_source_files`. This relationship doesn't make much sense, as a loose source can totally exist standalone without the files source.
We're thus getting rid of this relationship in this series, too. I found it quite hard to reason about which pointer one is holding at any point in time though, doubly so because the parent pointer was named "source", which is rather generic. The second commit thus renames the pointer to `files` and converts it into `struct odb_source_files` to make the transition cleaner, but the whole pointer will be dropped at the end of this series.
The series is built on top of aec3f58750 (Sync with 'maint', 2026-05-21) with ps/odb-in-memory at d2902a4549 (t/unit-tests: add tests for the in-memory object source, 2026-04-10) merged into it.
Thanks!
Patrick
---
Patrick Steinhardt (18):
odb/source-loose: move loose source into "odb/" subsystem
odb/source-loose: store pointer to "files" instead of generic source
odb/source-loose: start converting to a proper `struct odb_source`
odb/source-loose: wire up `reprepare()` callback
odb/source-loose: wire up `close()` callback
odb/source-loose: wire up `read_object_info()` callback
odb/source-loose: wire up `read_object_stream()` callback
odb/source-loose: wire up `for_each_object()` callback
odb/source-loose: wire up `find_abbrev_len()` callback
odb/source-loose: wire up `count_objects()` callback
odb/source-loose: drop `odb_source_loose_has_object()`
odb/source-loose: wire up `freshen_object()` callback
loose: refactor object map to operate on `struct odb_source_loose`
odb/source-loose: wire up `write_object()` callback
object-file: refactor writing objects to use loose source
odb/source-loose: wire up `write_object_stream()` callback
odb/source-loose: stub out remaining callbacks
odb/source-loose: drop pointer to the "files" sourceMakefile | 1 + builtin/cat-file.c | 5 +- builtin/gc.c | 6 +- builtin/pack-objects.c | 12 +- http-walker.c | 3 +- http.c | 6 +- loose.c | 45 ++- loose.h | 4 +- meson.build | 1 + object-file.c | 796 ++++--------------------------------------------- object-file.h | 149 ++++----- odb/source-files.c | 28 +- odb/source-loose.c | 736 +++++++++++++++++++++++++++++++++++++++++++++ odb/source-loose.h | 48 +++ odb/source.h | 3 + 15 files changed, 973 insertions(+), 870 deletions(-)
--- base-commit: 072edab49f312c80561b2899f03f361f74fc38e4 change-id: 20260413-b4-pks-odb-source-loose-4900c8ca91db