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

Re: [PATCH 01/12] cache-tree: remove dependency on `the_repository`

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 1, 2026, 22:47 UTC
Message-ID
<xmqqmru0lhcn.fsf@gitster.g>
In-Reply-To
<20260901-pks-odb-registering-in-memory-sources-v1-1-97a312d5fa25@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 11 quoted lines
> diff --git a/cache-tree.c b/cache-tree.c
> index a220372a42..6e4d82f3e8 100644
> --- a/cache-tree.c
> +++ b/cache-tree.c
> ...
> @@ -775,7 +781,7 @@ struct tree *write_in_core_index_as_tree(struct repository *repo,
>  	int was_valid, ret;
>  
>  	was_valid = index_state->cache_tree &&
> -		    cache_tree_fully_valid(index_state->cache_tree);
> +		    cache_tree_fully_valid(repo, index_state->cache_tree);

Here you use "repo". I do not know offhand if the two callers of this function write_in_core_index_as_tree() are correct (they are in builtin/history.c and not my code), but if they are, then "repo" should match "index_state->repo". And if they aren't, this code is broken.

Either way, passing index_state->repo would be the right thing to do here. Perhaps write_in_core_index_as_tree() should be corrected to drop its "repo" parameter.

Show 11 quoted lines
> diff --git a/unpack-trees.c b/unpack-trees.c
> index 154d6d40a1..20e6d6d824 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> ...
> @@ -2086,7 +2087,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
>  			}
>  
>  			if (!o->skip_cache_tree_update &&
> -			    !cache_tree_fully_valid(o->internal.result.cache_tree))
> +			    !cache_tree_fully_valid(the_repository, o->internal.result.cache_tree))

The o->internal.result is a full fledged istate instance and comes with its own repository. It may or may not be the same as the_repository.

If this were a misconversion, it would argue strongly for a thin wrapper I suggested in the other message, that only takes an istate instance and infers which repository and which cache-tree to work with.

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