git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 4 of 23 in “odb: stop registering in-memory sources”
  1. 00/13 odb: stop registering in-memory sourcesPatrick Steinhardt, Sep 2, 2026
  2. 01/13 cache-tree: drop `the_repository` in `cache_tree_fully_valid()`Patrick Steinhardt, Sep 2, 2026
  3. 02/13 cache-tree: remove dependency on `the_repository`Patrick Steinhardt, Sep 2, 2026
  4. Karthik NayakSep 4, 2026
  5. Patrick SteinhardtSep 7, 2026
  6. 03/13 submodule-config: remove uses of `the_repository`Patrick Steinhardt, Sep 2, 2026
  7. 04/13 submodule-config: stop using `the_hash_algo`Patrick Steinhardt, Sep 2, 2026
  8. 05/13 submodule-config: stop registering submodule sourcesPatrick Steinhardt, Sep 2, 2026
  9. Justin ToblerSep 6, 2026
  10. Patrick SteinhardtSep 7, 2026
  11. Justin ToblerSep 8, 2026
  12. Patrick SteinhardtSep 9, 2026
  13. 06/13 builtin/grep: stop registering submodule ODB as sourcePatrick Steinhardt, Sep 2, 2026
  14. 07/13 odb: remove infrastructure to register submodule sourcesPatrick Steinhardt, Sep 2, 2026
  15. Karthik NayakSep 4, 2026
  16. 08/13 tmp-objdir: drop unused function to register alternatePatrick Steinhardt, Sep 2, 2026
  17. 09/13 odb/packed: fix memory leaks when freeing sourcePatrick Steinhardt, Sep 2, 2026
  18. 10/13 builtin/multi-pack-index: refuse unknown sources with "--object-dir="Patrick Steinhardt, Sep 2, 2026
  19. Justin ToblerSep 8, 2026
  20. 11/13 t/helper: adapt read-midx to not link ad-hoc source anymorePatrick Steinhardt, Sep 2, 2026
  21. 12/13 t/helper: stop registering alternates in "ref-store" commandPatrick Steinhardt, Sep 2, 2026
  22. 13/13 odb: remove the ability to link sources ad-hocPatrick Steinhardt, Sep 2, 2026
  23. Karthik NayakSep 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.