Thread (35 messages) flat view 35 messages, 4 authors, 10h ago

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

From: Karthik Nayak <hidden>
Date: 2026-09-04 22:37:00

Patrick Steinhardt [off-list ref] writes:
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.
quoted hunk ↗ jump to hunk
Signed-off-by: Patrick Steinhardt <redacted>
---
 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.
quoted hunk ↗ jump to hunk
 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.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help