git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:26 UTC

Re: [PATCH v2 07/13] odb: remove infrastructure to register submodule sources

From
Karthik Nayak <karthik.188@gmail.com>
Date
Sep 4, 2026, 22:36 UTC
Message-ID
<CAOLa=ZSW=kZ4BQ9updQ9jvTs=g1oWe_24LpAaSW082iQkQcFrA@mail.gmail.com>
In-Reply-To
<20260902-pks-odb-registering-in-memory-sources-v2-7-c6ca12fdea4d@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 11 quoted lines
> The preceding commits have removed the last two users of
> `odb_add_submodule_source_by_path()`. The mechanism was only ever
> meant as a transitional crutch while migrating submodule object
> access away from "add the submodule ODB as an alternate of
> the_repository" towards explicitly passing the submodule repository,
> see a35e03dee0 (submodule: lazily add submodule ODBs as alternates,
> 2021-08-16). Remove it.
>
> As GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB is now a no-op, remove its
> documentation and the exports from the test suite, as well.
>

Okay so the last two commits removed the last two sources which registered the submodule as an in-memory odb.

That leaves us to cleanup all the code around it.
Show 52 quoted lines
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  odb.c                                  | 36 ----------------------------------
>  odb.h                                  | 14 -------------
>  t/README                               |  7 -------
>  t/t5526-fetch-submodules.sh            |  3 ---
>  t/t5531-deep-submodule-push.sh         |  3 ---
>  t/t5545-push-options.sh                |  3 ---
>  t/t5572-pull-submodule.sh              |  3 ---
>  t/t6437-submodule-merge.sh             |  3 ---
>  t/t7418-submodule-sparse-gitmodules.sh |  3 ---
>  t/t7814-grep-recurse-submodules.sh     |  3 ---
>  10 files changed, 78 deletions(-)
>
> diff --git a/odb.c b/odb.c
> index 6d5943e5ea..2f8a70a90c 100644
> --- a/odb.c
> +++ b/odb.c
> @@ -388,12 +388,6 @@ struct odb_source *odb_find_source_or_die(struct object_database *odb, const cha
>  	return source;
>  }
>
> -void odb_add_submodule_source_by_path(struct object_database *odb,
> -				      const char *path)
> -{
> -	string_list_insert(&odb->submodule_source_paths, path);
> -}
> -
>  static void fill_alternate_refs_command(struct repository *repo,
>  					struct child_process *cmd,
>  					const char *repo_path)
> @@ -549,23 +543,6 @@ void disable_obj_read_lock(void)
>  	pthread_mutex_destroy(&obj_read_mutex);
>  }
>
> -static int register_all_submodule_sources(struct object_database *odb)
> -{
> -	int ret = odb->submodule_source_paths.nr;
> -
> -	for (size_t i = 0; i < odb->submodule_source_paths.nr; i++)
> -		odb_add_to_alternates_memory(odb,
> -					     odb->submodule_source_paths.items[i].string);
> -	if (ret) {
> -		string_list_clear(&odb->submodule_source_paths, 0);
> -		trace2_data_intmax("submodule", odb->repo,
> -				   "register_all_submodule_sources/registered", ret);
> -		if (git_env_bool("GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB", 0))
> -			BUG("register_all_submodule_sources() called");
> -	}
> -	return ret;
> -}
> -
Nice, so this remove the code to add the submodules as alternates.
Show 17 quoted lines
>  static enum odb_read_status do_oid_object_info_extended(struct object_database *odb,
>  							const struct object_id *oid,
>  							struct object_info *oi, unsigned flags)
> @@ -614,16 +591,6 @@ static enum odb_read_status do_oid_object_info_extended(struct object_database *
>  			}
>  		}
>
> -		/*
> -		 * This might be an attempt at accessing a submodule object as
> -		 * if it were in main object store (having called
> -		 * `odb_add_submodule_source_by_path()` on that submodule's
> -		 * ODB). If any such ODBs exist, register them and try again.
> -		 */
> -		if (register_all_submodule_sources(odb))
> -			/* We added some alternates; retry */
> -			continue;
> -
Right so this is the retry mechanism when readin an object fails.
[snip]
The rest look in order.
Previous: Karthik NayakNext: Karthik Nayak
Message 16 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. 03/13 submodule-config: remove uses of `the_repository`Patrick Steinhardt, Sep 2, 2026
  5. 04/13 submodule-config: stop using `the_hash_algo`Patrick Steinhardt, Sep 2, 2026
  6. 05/13 submodule-config: stop registering submodule sourcesPatrick Steinhardt, Sep 2, 2026
  7. 06/13 builtin/grep: stop registering submodule ODB as sourcePatrick Steinhardt, Sep 2, 2026
  8. 07/13 odb: remove infrastructure to register submodule sourcesPatrick Steinhardt, Sep 2, 2026
  9. 08/13 tmp-objdir: drop unused function to register alternatePatrick Steinhardt, Sep 2, 2026
  10. 09/13 odb/packed: fix memory leaks when freeing sourcePatrick Steinhardt, Sep 2, 2026
  11. 10/13 builtin/multi-pack-index: refuse unknown sources with "--object-dir="Patrick Steinhardt, Sep 2, 2026
  12. 11/13 t/helper: adapt read-midx to not link ad-hoc source anymorePatrick Steinhardt, Sep 2, 2026
  13. 12/13 t/helper: stop registering alternates in "ref-store" commandPatrick Steinhardt, Sep 2, 2026
  14. 13/13 odb: remove the ability to link sources ad-hocPatrick Steinhardt, Sep 2, 2026
  15. Karthik NayakSep 4, 2026
  16. Karthik NayakSep 4, 2026
  17. Karthik NayakSep 4, 2026
  18. Justin ToblerSep 6, 2026
  19. Patrick SteinhardtSep 7, 2026
  20. Patrick SteinhardtSep 7, 2026
  21. Justin ToblerSep 8, 2026
  22. Justin ToblerSep 8, 2026
  23. Patrick SteinhardtSep 9, 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.