From: Justin Tobler Date: Tue, 16 Jun 2026 21:36:59 GMT Subject: Re: [PATCH v2 05/17] odb/source-packed: start converting to a proper `struct odb_source` Message-ID: In-Reply-To: <20260609-pks-odb-source-packed-v2-5-839089132c8b@pks.im> On 26/06/09 10:50AM, Patrick Steinhardt wrote: > Start converting `struct odb_source_packed` into a proper pluggable > `struct odb_source` by embedding the base struct and assigning it the > new `ODB_SOURCE_PACKED` type. Furthermore, wire up lifecycle management > of this source by implementing the `free` callback and taking ownership > of the chdir notifications. > > Note that the packed source is not yet functional as a standalone `struct > odb_source`, as it's missing all of the callback implementations. These > will be wired up in subsequent commits. Ok. > Signed-off-by: Patrick Steinhardt > --- [snip] > struct odb_source_packed *odb_source_packed_new(struct odb_source_files *parent) > { > - struct odb_source_packed *store; > - CALLOC_ARRAY(store, 1); > - store->files = parent; > - strmap_init(&store->packs_by_path); > - return store; > + struct odb_source_packed *packed; > + > + CALLOC_ARRAY(packed, 1); > + odb_source_init(&packed->base, parent->base.odb, ODB_SOURCE_PACKED, > + parent->base.path, parent->base.local); > + packed->files = parent; > + strmap_init(&packed->packs_by_path); > + > + packed->base.free = odb_source_packed_free; > + > + if (!is_absolute_path(parent->base.path)) > + chdir_notify_register(NULL, odb_source_packed_reparent, packed); Out of curiousity, did the packfile store previously not have to worry about changing directories? > + > + return packed; > } > diff --git a/odb/source-packed.h b/odb/source-packed.h > index 3c2d229a17..68e64cabab 100644 > --- a/odb/source-packed.h > +++ b/odb/source-packed.h > @@ -9,6 +9,7 @@ > * A store that manages packfiles for a given object database. > */ > struct odb_source_packed { > + struct odb_source base; > struct odb_source_files *files; At first I got confused as to why we were adding back a `struct odb_source` pointer, but this is for the "base" not the parent ODB source. We need to embed a `struct odb_source` here to make this a proper ODB source. Looking good. -Justin