From: Patrick Steinhardt Date: Wed, 15 Jul 2026 06:22:30 GMT Subject: [PATCH v4 0/9] odb: introduce object filters to `odb_for_each_object()` Message-ID: <20260715-pks-odb-for-each-object-filter-v4-0-616d7adf7fb7@pks.im> In-Reply-To: <20260709-pks-odb-for-each-object-filter-v1-0-82fe014b12b3@pks.im> Hi, this patch series introduces object filters to `odb_for_each_object()`. The intent of this is to make `git cat-file --batch-all-objects` work with pluggable object databases. Right now it doesn't because it reaches into internals of the "packed" backend to efficiently handle bitmapped objects. The series is built on top of f85a7e6620 (Start Git 2.56 cycle, 2026-07-06) with ps/odb-drop-whence at 8a7ad23e11 (odb: document object info fields, 2026-07-02) merged into it. Changes in v4: - Fix references to an old function name in commit messages. - Link to v3: https://patch.msgid.link/20260713-pks-odb-for-each-object-filter-v3-0-b3c65c641073@pks.im Changes in v3: - Weave Peff's patch into the patch series. - Link to v2: https://patch.msgid.link/20260710-pks-odb-for-each-object-filter-v2-0-3710a9cc165a@pks.im Changes in v2: - Add another patch to drop the `_1()` prefixes that aren't required anymore. - Change the approach in `open_bitmap_for_source()` to also use a `found` boolean instead of a confusing integer. - Add some more explanations to commit messages. - Link to v1: https://patch.msgid.link/20260709-pks-odb-for-each-object-filter-v1-0-82fe014b12b3@pks.im Thanks! Patrick --- Jeff King (1): pack-objects: drop unused return value from add_object_entry() Patrick Steinhardt (8): odb/source-packed: improve lookup when enumerating objects pack-bitmap: mark object filter as `const` pack-bitmap: allow aborting iteration of bitmapped objects pack-bitmap: iterate object sources when opening bitmaps pack-bitmap: drop `_1` suffix from functions that open bitmaps pack-bitmap: introduce function to open bitmap for a single source odb: introduce object filters to `odb_for_each_object()` builtin/cat-file: filter objects via object database builtin/cat-file.c | 76 +++-------------------------- builtin/pack-objects.c | 11 ++--- builtin/rev-list.c | 2 +- odb.h | 12 +++++ odb/source-packed.c | 77 ++++++++++++++++++++++++++--- pack-bitmap.c | 129 +++++++++++++++++++++++++++---------------------- pack-bitmap.h | 10 +++- 7 files changed, 175 insertions(+), 142 deletions(-) Range-diff versus v3: 1: 2d4bc229ac = 1: 30cf75ce12 odb/source-packed: improve lookup when enumerating objects 2: dfa942f6da = 2: 735eb8ad5c pack-bitmap: mark object filter as `const` 3: 9bfba42b27 = 3: a1f32c5ea6 pack-objects: drop unused return value from add_object_entry() 4: 405c77bad3 = 4: acb0aad580 pack-bitmap: allow aborting iteration of bitmapped objects 5: 70e68f10aa = 5: 199db72f4c pack-bitmap: iterate object sources when opening bitmaps 6: 08ba2c1db3 = 6: 69d5882b57 pack-bitmap: drop `_1` suffix from functions that open bitmaps 7: d410cfa4e2 ! 7: a1eabafebd pack-bitmap: introduce function to open bitmap for a single source @@ Commit message - With multiple sources, each source would enumerate the same bitmap another time. - Introduce a new function `prepare_source_bitmap_git()` that only opens - bitmaps belonging to the given object source. + Introduce a new function `prepare_bitmap_git_for_source()` that only + opens bitmaps belonging to the given object source. Signed-off-by: Patrick Steinhardt 8: e0df97e318 ! 8: 6ef9885006 odb: introduce object filters to `odb_for_each_object()` @@ Commit message So in the end, this alternative would only limit us artificially. Implement the logic for the "packed" source. Note that we use the new - function `prepare_source_bitmap_git()` to open the bitmap: as the + function `prepare_bitmap_git_for_source()` to open the bitmap: as the backend operates on a single object source, we must only use bitmaps that belong to that specific source. Otherwise we might yield objects that are not part of the source at all, and with multiple sources we 9: e866b1f4b8 = 9: 104da65906 builtin/cat-file: filter objects via object database --- base-commit: 3c8e2790f2ce15e8b5d4b4e6ced711b12649f32a change-id: 20260708-pks-odb-for-each-object-filter-13286fa3523d