aboutsummaryrefslogtreecommitdiff
path: root/commit-graph.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-20 08:07:29 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-20 13:16:41 -0700
commitcfd575f0a9730712107e4ee6799a37665bcd8204 (patch)
treef52a43e428ac45cb952a3965f8855eb997a2d3df /commit-graph.c
parentfe446b01aeaab307adcbfb39d4aaa72c37afbcda (diff)
downloadgit-cfd575f0a9730712107e4ee6799a37665bcd8204.tar.xz
odb: introduce `struct odb_for_each_object_options`
The `odb_for_each_object()` function only accepts a bitset of flags. In a subsequent commit we'll want to change object iteration to also support iterating over only those objects that have a specific prefix. While we could of course add the prefix to the function signature, or alternatively introduce a new function, both of these options don't really seem to be that sensible. Instead, introduce a new `struct odb_for_each_object_options` that can be passed to a new `odb_for_each_object_ext()` function. Splice through the options structure into the respective object database sources. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/commit-graph.c b/commit-graph.c
index c030003330..df4b4a125e 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1969,6 +1969,9 @@ static void fill_oids_from_all_packs(struct write_commit_graph_context *ctx)
{
struct odb_source *source;
enum object_type type;
+ struct odb_for_each_object_options opts = {
+ .flags = ODB_FOR_EACH_OBJECT_PACK_ORDER,
+ };
struct object_info oi = {
.typep = &type,
};
@@ -1983,7 +1986,7 @@ static void fill_oids_from_all_packs(struct write_commit_graph_context *ctx)
for (source = ctx->r->objects->sources; source; source = source->next) {
struct odb_source_files *files = odb_source_files_downcast(source);
packfile_store_for_each_object(files->packed, &oi, add_packed_commits_oi,
- ctx, ODB_FOR_EACH_OBJECT_PACK_ORDER);
+ ctx, &opts);
}
if (ctx->progress_done < ctx->approx_nr_objects)