From: Justin Tobler <jltobler@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 05/13] submodule-config: stop registering submodule sources
Date: Sun, 6 Sep 2026 13:38:15 -0500 [thread overview]
Message-ID: <ap2wj0vK0-VUvaW5@denethor> (raw)
In-Reply-To: <20260902-pks-odb-registering-in-memory-sources-v2-5-c6ca12fdea4d@pks.im>
On 26/09/02 03:34PM, Patrick Steinhardt wrote:
> When reading the ".gitmodules" file from a blob in a repository other
> than `the_repository`, we register the repository's object database as
> an in-memory source of `the_repository`'s object database. This call has
> its origins in d9b8b8f896 (submodule-config.c: use repo_get_oid for
> reading .gitmodules, 2019-04-16): back then, `config_with_options()` was
> not able to read a blob from an arbitrary repository, but would always
> read it via `the_repository`. So even though the blob could be resolved
> in the submodule repository via `repo_get_oid()`, the submodule's object
> database had to be registered as an in-memory source of `the_repository`
> so that the subsequent object read was able to find the blob at all.
Ok, so IIUC the problem was that a gitmodule blob from a repository that
is not "the_repository" would fail to be read by `config_with_options()`
because it would only read objects from "the_repository". The workaround
was to add the other repositories as another source to ensure the
gitmodule blob could be read. I had to reread the commit message a
couple of times to follow, but I think it makes sense now.
> That need went away with e3e8bf046e (submodule-config: pass repo
> upon blob config read, 2021-08-16), which taught the config machinery
> to read the blob from the repository we pass to it. The same series
> converted the eager submodule source registration into a lazy mechanism
> that only registers submodule sources with the object database when an
> object lookup failed. The intent though was that we don't ever have to
> fall back to this mechanism in the first place, and to verify that this
> is the case we introduced GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB. If set,
> then any such lazy registration would cause us to BUG.
>
> At the beginning of this series, we still triggered this bug in t1092.
> But now that we have converted the "cache-tree" subsystem to not depend
> on `the_repository` anymore it also knows to properly access objects via
> the submodule. With that change, GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
> does not cause any failures anymore.
Ok, now we can properly read objects from their respective repository
source and no longer neeed the workaround.
> Remove the call to `odb_add_submodule_source_by_path()`. This removes
> the last user of `the_repository`, so at the same time we can also get
> rid of `USE_THE_REPOSITORY_VARIABLE`.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> submodule-config.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/submodule-config.c b/submodule-config.c
> index 7c73fa108b..37c3be377b 100644
> --- a/submodule-config.c
> +++ b/submodule-config.c
> @@ -1,4 +1,3 @@
> -#define USE_THE_REPOSITORY_VARIABLE
> #define DISABLE_SIGN_COMPARE_WARNINGS
>
> #include "git-compat-util.h"
> @@ -803,9 +802,6 @@ static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void
> } else if (repo_get_oid(repo, GITMODULES_INDEX, &oid) >= 0 ||
> repo_get_oid(repo, GITMODULES_HEAD, &oid) >= 0) {
> config_source.blob = oidstr = xstrdup(oid_to_hex(&oid));
> - if (repo != the_repository)
> - odb_add_submodule_source_by_path(the_repository->objects,
> - repo->objects->sources->path);
Nice to have one less workaround. :)
-Justin
next prev parent reply other threads:[~2026-09-06 18:38 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 11:08 [PATCH 00/12] odb: stop registering in-memory sources Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 01/12] cache-tree: remove dependency on `the_repository` Patrick Steinhardt
2026-09-01 22:03 ` Junio C Hamano
2026-09-02 10:23 ` Patrick Steinhardt
2026-09-01 22:47 ` Junio C Hamano
2026-09-01 11:09 ` [PATCH 02/12] submodule-config: remove uses of `the_repository` Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 03/12] submodule-config: stop using `the_hash_algo` Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 04/12] submodule-config: stop registering submodule sources Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 05/12] builtin/grep: stop registering submodule ODB as source Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 06/12] odb: remove infrastructure to register submodule sources Patrick Steinhardt
2026-09-01 22:26 ` Junio C Hamano
2026-09-01 11:09 ` [PATCH 07/12] tmp-objdir: drop unused function to register alternate Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 08/12] odb/packed: fix memory leaks when freeing source Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 09/12] builtin/multi-pack-index: refuse unknown sources with "--object-dir=" Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 10/12] t/helper: adapt read-midx to not link ad-hoc source anymore Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 11/12] t/helper: stop registering alternates in "ref-store" command Patrick Steinhardt
2026-09-01 11:09 ` [PATCH 12/12] odb: remove the ability to link sources ad-hoc Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 00/13] odb: stop registering in-memory sources Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 01/13] cache-tree: drop `the_repository` in `cache_tree_fully_valid()` Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 02/13] cache-tree: remove dependency on `the_repository` Patrick Steinhardt
2026-09-04 22:28 ` Karthik Nayak
2026-09-07 7:49 ` Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 03/13] submodule-config: remove uses of `the_repository` Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 04/13] submodule-config: stop using `the_hash_algo` Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 05/13] submodule-config: stop registering submodule sources Patrick Steinhardt
2026-09-06 18:38 ` Justin Tobler [this message]
2026-09-07 7:50 ` Patrick Steinhardt
2026-09-08 23:04 ` Justin Tobler
2026-09-09 5:52 ` Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 06/13] builtin/grep: stop registering submodule ODB as source Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 07/13] odb: remove infrastructure to register submodule sources Patrick Steinhardt
2026-09-04 22:36 ` Karthik Nayak
2026-09-02 13:34 ` [PATCH v2 08/13] tmp-objdir: drop unused function to register alternate Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 09/13] odb/packed: fix memory leaks when freeing source Patrick Steinhardt
2026-09-02 13:34 ` [PATCH v2 10/13] builtin/multi-pack-index: refuse unknown sources with "--object-dir=" Patrick Steinhardt
2026-09-08 23:12 ` Justin Tobler
2026-09-02 13:34 ` [PATCH v2 11/13] t/helper: adapt read-midx to not link ad-hoc source anymore Patrick Steinhardt
2026-09-02 13:35 ` [PATCH v2 12/13] t/helper: stop registering alternates in "ref-store" command Patrick Steinhardt
2026-09-02 13:35 ` [PATCH v2 13/13] odb: remove the ability to link sources ad-hoc Patrick Steinhardt
2026-09-04 22:45 ` [PATCH v2 00/13] odb: stop registering in-memory sources Karthik Nayak
2026-09-11 5:51 ` [PATCH v3 " Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 01/13] cache-tree: drop `the_repository` in `cache_tree_fully_valid()` Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 02/13] cache-tree: remove dependency on `the_repository` Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 03/13] submodule-config: remove uses of `the_repository` Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 04/13] submodule-config: stop using `the_hash_algo` Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 05/13] submodule-config: stop registering submodule sources Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 06/13] builtin/grep: stop registering submodule ODB as source Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 07/13] odb: remove infrastructure to register submodule sources Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 08/13] tmp-objdir: drop unused function to register alternate Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 09/13] odb/packed: fix memory leaks when freeing source Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 10/13] builtin/multi-pack-index: refuse unknown sources with "--object-dir=" Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 11/13] t/helper: adapt read-midx to not link ad-hoc source anymore Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 12/13] t/helper: stop registering alternates in "ref-store" command Patrick Steinhardt
2026-09-11 5:51 ` [PATCH v3 13/13] odb: remove the ability to link sources ad-hoc Patrick Steinhardt
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=ap2wj0vK0-VUvaW5@denethor \
--to=jltobler@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.