Re: [PATCH v2 02/13] cache-tree: remove dependency on `the_repository`
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Sep 4, 2026, 22:28 UTC
- Message-ID
- <CAOLa=ZQ=oCDtjAQXNXe51DvKUCCk0CK1EuM+QKhJ3iH8YiS+mw@mail.gmail.com>
- In-Reply-To
- <20260902-pks-odb-registering-in-memory-sources-v2-2-c6ca12fdea4d@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 17 quoted lines
> The "cache-tree" subsystem still depends on `the_repository`. Adapt it > to instead use repositories provided via the context, either as a new > parameter or the one passed in via `struct index_state`. > > Besides getting rid of `the_repository`, this also removes the last > dependency on registering submodule sources with the main object > database. When reading gitmodules from a submodule's index we implicitly > read that object via `the_repository`'s object database, which is of > course wrong. This works though because we would then register the > submodule's object database with the main object database, but a later > patch is going to get rid of that mechanism. > > You can verify that we indeed no longer depend on this mechanism by > running tests with `GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=true`. Without > this patch we fail in t1092, with this patch we never register submodule > object databases anymore. >
Interesting, to sum up if I understand correctly, somewhere in the call chain of looking up the gitmodules from the submodules index, we end up using 'the_repository' instead of the submodule's repo structure.
This is of course wrong, because we use the wrong repo, the consequence is that the lookup fails, but we have a last ditch effort of adding all submodules as alternates and retrying the object read, this succeeds.
So this patch fixes the repository being correctly passed down. Meaning we no longer need to add the submodules as an alternate.
[snip]
The changes look good.