From: Justin Tobler <jltobler@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Karthik Nayak <karthik.188@gmail.com>
Subject: Re: [PATCH v2 04/17] odb/source-packed: store pointer to "files" instead of generic source
Date: Tue, 16 Jun 2026 16:14:02 -0500 [thread overview]
Message-ID: <ajG69JZHx_u2mt7q@denethor> (raw)
In-Reply-To: <20260609-pks-odb-source-packed-v2-4-839089132c8b@pks.im>
On 26/06/09 10:50AM, Patrick Steinhardt wrote:
> The `struct odb_source_packed` holds a pointer to its owning parent
> source. The way that Git is currently structured, this parent is always
> the "files" source. In subsequent commits we're going to detangle that
> so that the "packed" source doesn't have any owning parent source at
> all, which makes it usable as a completely standalone source.
Out of curiousity, `struct odb_source_loose` also stores a similar to
pointer to its owning parent. Is the plan to also eventually do the same
there?
> Detangling this mess is somewhat intricate though, and is made even more
> intricate because it's not always clear which kind of source one is
> holding at a specific point in time -- either the parent "files" source,
> or the child "packed" source.
>
> Make this relationship more explicit by storing a pointer to the "files"
> source instead of storing a pointer to a generic `struct odb_source`.
> This will help make subsequent steps a bit clearer.
>
> Note that this is a temporary step, only. At the end of this series
> we will have dropped the parent pointer completely.
Ok, so IIUC the eventual goal is to get rid of the pointer entirely, but
for now we are just making its concrete type explicit without having to
downcast. It's not immediately obvious to me how this step gets us
closer to that goal, but that may become more obvious in the next
patches. :)
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> odb/source-files.c | 2 +-
> odb/source-packed.c | 4 ++--
> odb/source-packed.h | 4 ++--
> packfile.c | 12 ++++++------
> 4 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/odb/source-files.c b/odb/source-files.c
> index 191562f316..e04525fb08 100644
> --- a/odb/source-files.c
> +++ b/odb/source-files.c
> @@ -269,7 +269,7 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
> CALLOC_ARRAY(files, 1);
> odb_source_init(&files->base, odb, ODB_SOURCE_FILES, path, local);
> files->loose = odb_source_loose_new(odb, path, local);
> - files->packed = odb_source_packed_new(&files->base);
> + files->packed = odb_source_packed_new(files);
>
> files->base.free = odb_source_files_free;
> files->base.close = odb_source_files_close;
> diff --git a/odb/source-packed.c b/odb/source-packed.c
> index 1e94b47ea0..12e785be48 100644
> --- a/odb/source-packed.c
> +++ b/odb/source-packed.c
> @@ -1,11 +1,11 @@
> #include "git-compat-util.h"
> #include "odb/source-packed.h"
>
> -struct odb_source_packed *odb_source_packed_new(struct odb_source *source)
> +struct odb_source_packed *odb_source_packed_new(struct odb_source_files *parent)
> {
> struct odb_source_packed *store;
> CALLOC_ARRAY(store, 1);
> - store->source = source;
> + store->files = parent;
> strmap_init(&store->packs_by_path);
> return store;
> }
> diff --git a/odb/source-packed.h b/odb/source-packed.h
> index 327be4ad65..3c2d229a17 100644
> --- a/odb/source-packed.h
> +++ b/odb/source-packed.h
> @@ -9,7 +9,7 @@
> * A store that manages packfiles for a given object database.
> */
> struct odb_source_packed {
> - struct odb_source *source;
> + struct odb_source_files *files;
The rest of this patch updates the callsites accordingly and looks
correct.
-Justin
next prev parent reply other threads:[~2026-06-16 21:14 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 11:25 [PATCH 00/16] odb: make packed object source a proper `struct odb_source` Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 01/16] packfile: rename `struct packfile_store` to `odb_source_packed` Patrick Steinhardt
2026-06-05 14:25 ` Karthik Nayak
2026-06-08 6:23 ` Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 02/16] packfile: move packed source into "odb/" subsystem Patrick Steinhardt
2026-06-08 15:09 ` Karthik Nayak
2026-06-09 7:27 ` Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 03/16] odb/source-packed: store pointer to "files" instead of generic source Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 04/16] odb/source-packed: start converting to a proper `struct odb_source` Patrick Steinhardt
2026-06-08 15:29 ` Karthik Nayak
2026-06-09 7:27 ` Patrick Steinhardt
2026-06-09 10:47 ` Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 05/16] odb/source-packed: wire up `close()` callback Patrick Steinhardt
2026-06-08 15:31 ` Karthik Nayak
2026-06-04 11:25 ` [PATCH 06/16] odb/source-packed: wire up `reprepare()` callback Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 07/16] packfile: use higher-level interface to implement `has_object_pack()` Patrick Steinhardt
2026-06-08 16:07 ` Karthik Nayak
2026-06-04 11:25 ` [PATCH 08/16] odb/source-packed: wire up `read_object_info()` callback Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 09/16] odb/source-packed: wire up `read_object_stream()` callback Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 10/16] odb/source-packed: wire up `for_each_object()` callback Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 11/16] odb/source-packed: wire up `count_objects()` callback Patrick Steinhardt
2026-06-08 16:12 ` Karthik Nayak
2026-06-09 7:27 ` Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 12/16] odb/source-packed: wire up `find_abbrev_len()` callback Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 13/16] odb/source-packed: wire up `freshen_object()` callback Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 14/16] odb/source-packed: stub out remaining functions Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 15/16] midx: refactor interfaces to work on "packed" source Patrick Steinhardt
2026-06-04 11:25 ` [PATCH 16/16] odb/source-packed: drop pointer to "files" parent source Patrick Steinhardt
2026-06-08 16:15 ` [PATCH 00/16] odb: make packed object source a proper `struct odb_source` Karthik Nayak
2026-06-09 7:27 ` Patrick Steinhardt
2026-06-09 8:50 ` [PATCH v2 00/17] " Patrick Steinhardt
2026-06-09 8:50 ` [PATCH v2 01/17] packfile: rename `struct packfile_store` to `odb_source_packed` Patrick Steinhardt
2026-06-16 21:01 ` Justin Tobler
2026-06-09 8:50 ` [PATCH v2 02/17] packfile: split out packfile list logic Patrick Steinhardt
2026-06-09 8:50 ` [PATCH v2 03/17] packfile: move packed source into "odb/" subsystem Patrick Steinhardt
2026-06-09 8:50 ` [PATCH v2 04/17] odb/source-packed: store pointer to "files" instead of generic source Patrick Steinhardt
2026-06-16 21:14 ` Justin Tobler [this message]
2026-06-16 21:28 ` Justin Tobler
2026-06-09 8:50 ` [PATCH v2 05/17] odb/source-packed: start converting to a proper `struct odb_source` Patrick Steinhardt
2026-06-16 21:36 ` Justin Tobler
2026-06-09 8:50 ` [PATCH v2 06/17] odb/source-packed: wire up `close()` callback Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 07/17] odb/source-packed: wire up `reprepare()` callback Patrick Steinhardt
2026-06-16 21:53 ` Justin Tobler
2026-06-09 8:51 ` [PATCH v2 08/17] packfile: use higher-level interface to implement `has_object_pack()` Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 09/17] odb/source-packed: wire up `read_object_info()` callback Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 10/17] odb/source-packed: wire up `read_object_stream()` callback Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 11/17] odb/source-packed: wire up `for_each_object()` callback Patrick Steinhardt
2026-06-16 22:10 ` Justin Tobler
2026-06-09 8:51 ` [PATCH v2 12/17] odb/source-packed: wire up `count_objects()` callback Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 13/17] odb/source-packed: wire up `find_abbrev_len()` callback Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 14/17] odb/source-packed: wire up `freshen_object()` callback Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 15/17] odb/source-packed: stub out remaining functions Patrick Steinhardt
2026-06-09 8:51 ` [PATCH v2 16/17] midx: refactor interfaces to work on "packed" source Patrick Steinhardt
2026-06-16 22:37 ` Justin Tobler
2026-06-09 8:51 ` [PATCH v2 17/17] odb/source-packed: drop pointer to "files" parent source Patrick Steinhardt
2026-06-16 22:51 ` Justin Tobler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ajG69JZHx_u2mt7q@denethor \
--to=jltobler@gmail.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox