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 16/17] midx: refactor interfaces to work on "packed" source
Date: Tue, 16 Jun 2026 17:37:53 -0500 [thread overview]
Message-ID: <ajHKmbimHJnFV2IE@denethor> (raw)
In-Reply-To: <20260609-pks-odb-source-packed-v2-16-839089132c8b@pks.im>
On 26/06/09 10:51AM, Patrick Steinhardt wrote:
> Our interfaces used to interact with MIDXs all work on top of the
> generic `struct odb_source`. This doesn't make much sense though: a MIDX
> is strictly tied to the "packed" source, so passing in a generic source
> gives the false sense that it may also work with a different type of
> source.
A `struct odb_source_packed` now acts as the source specific to all
packfiles in the repository. Being that MIDXs only work with packfiles,
it also makes sense to me to use the appropriate concrete source here.
> Fix this conceptual weirdness and instead require the caller to pass in
> a "packed" source explicitly. This also makes the next commit easier to
> implement, where we drop the pointer to the "files" source in the
> "packed" source.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> builtin/multi-pack-index.c | 29 +++++------
> builtin/pack-objects.c | 3 +-
> builtin/repack.c | 8 ++-
> midx-write.c | 34 ++++++-------
> midx.c | 118 ++++++++++++++++++++++-----------------------
> midx.h | 30 ++++++------
> odb/source-packed.c | 12 ++---
> pack-bitmap.c | 8 +--
> pack-revindex.c | 6 +--
> repack-geometry.c | 3 +-
> repack-midx.c | 9 ++--
> repack.c | 6 +--
> t/helper/test-read-midx.c | 7 ++-
> 13 files changed, 144 insertions(+), 129 deletions(-)
>
> diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
> index 00ffb36394..6e73c85cde 100644
> --- a/builtin/multi-pack-index.c
> +++ b/builtin/multi-pack-index.c
> @@ -10,6 +10,7 @@
> #include "trace2.h"
> #include "odb.h"
> #include "odb/source.h"
> +#include "odb/source-files.h"
> #include "replace-object.h"
> #include "repository.h"
>
> @@ -85,12 +86,12 @@ static int parse_object_dir(const struct option *opt, const char *arg,
> return 0;
> }
>
> -static struct odb_source *handle_object_dir_option(struct repository *repo)
> +static struct odb_source_files *handle_object_dir_option(struct repository *repo)
> {
> struct odb_source *source = odb_find_source(repo->objects, opts.object_dir);
> if (!source)
> source = odb_add_to_alternates_memory(repo->objects, opts.object_dir);
> - return source;
> + return odb_source_files_downcast(source);
Now that we are passing around concrete ODB sources to many of these
interfaces, callers may have to handle downcasting explicitly. Since now
the downcasting may happen a bit ealier than previously in some cases, I
wondered if this would alter any error flows. I don't think this would
be the case though because ultimately we only have the "files" source
currently anyways.
The updates to the function signatures and call sites accordingly in
this patch all look good to me.
-Justin
next prev parent reply other threads:[~2026-06-16 22:37 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
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 [this message]
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=ajHKmbimHJnFV2IE@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