odb: remove infrastructure to register submodule sources
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.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
jch^2
parent
6f16066ff7
commit
b84469ad6e
36
odb.c
36
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* Check if it is a missing object */
|
||||
if (odb->repo->fetch_if_missing && repo_has_promisor_remote(odb->repo) &&
|
||||
!already_retried &&
|
||||
|
|
@ -1109,7 +1076,6 @@ struct object_database *odb_new(struct repository *repo,
|
|||
CALLOC_ARRAY(o, 1);
|
||||
o->repo = repo;
|
||||
pthread_mutex_init(&o->replace_mutex, NULL);
|
||||
string_list_init_dup(&o->submodule_source_paths);
|
||||
hashmap_init(&o->source_by_path, odb_source_by_path_cmp, o, 0);
|
||||
o->source_paths_icase = -1;
|
||||
|
||||
|
|
@ -1166,8 +1132,6 @@ void odb_free(struct object_database *o)
|
|||
odb_close(o);
|
||||
odb_free_sources(o);
|
||||
|
||||
string_list_clear(&o->submodule_source_paths, 0);
|
||||
|
||||
free(o);
|
||||
}
|
||||
|
||||
|
|
|
|||
14
odb.h
14
odb.h
|
|
@ -89,12 +89,6 @@ struct object_database {
|
|||
unsigned long object_count;
|
||||
unsigned object_count_flags;
|
||||
unsigned object_count_valid : 1;
|
||||
|
||||
/*
|
||||
* Submodule source paths that will be added as additional sources to
|
||||
* allow lookup of submodule objects via the main object database.
|
||||
*/
|
||||
struct string_list submodule_source_paths;
|
||||
};
|
||||
|
||||
enum odb_new_flags {
|
||||
|
|
@ -224,14 +218,6 @@ void odb_restore_primary_source(struct object_database *odb,
|
|||
struct odb_source *restore_source,
|
||||
const char *old_path);
|
||||
|
||||
/*
|
||||
* Call odb_add_submodule_source_by_path() to add the submodule at the given
|
||||
* path to a list. The object stores of all submodules in that list will be
|
||||
* added as additional sources in the object store when looking up objects.
|
||||
*/
|
||||
void odb_add_submodule_source_by_path(struct object_database *odb,
|
||||
const char *path);
|
||||
|
||||
/*
|
||||
* Iterate through all alternates of the database and execute the provided
|
||||
* callback function for each of them. Stop iterating once the callback
|
||||
|
|
|
|||
7
t/README
7
t/README
|
|
@ -462,13 +462,6 @@ GIT_TEST_CHECKOUT_WORKERS=<n> overrides the 'checkout.workers' setting
|
|||
to <n> and 'checkout.thresholdForParallelism' to 0, forcing the
|
||||
execution of the parallel-checkout code.
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=<boolean>, when true, makes
|
||||
registering submodule ODBs as alternates a fatal action. Support for
|
||||
this environment variable can be removed once the migration to
|
||||
explicitly providing repositories when accessing submodule objects is
|
||||
complete or needs to be abandoned for whatever reason (in which case the
|
||||
migrated codepaths still retain their performance benefits).
|
||||
|
||||
GIT_TEST_REQUIRE_PREREQ=<list> allows specifying a space separated list of
|
||||
prereqs that are required to succeed. If a prereq in this list is triggered by
|
||||
a test and then fails then the whole test run will abort. This can help to make
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
|
||||
test_description='Recursive "git fetch" for submodules'
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
pwd=$(pwd)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ test_description='test push with submodules'
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success setup '
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ test_description='pushing to a repository using push options'
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
mk_repo_pair () {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
test_description='pull can handle submodules'
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-submodule-update.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ test_description='merging with submodules'
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ The test setup uses a sparse checkout, however the same scenario can be set up
|
|||
also by committing .gitmodules and then just removing it from the filesystem.
|
||||
'
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'setup' '
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ submodules.
|
|||
TEST_CREATE_REPO_NO_TEMPLATE=1
|
||||
. ./test-lib.sh
|
||||
|
||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||
|
||||
test_expect_success 'setup directory structure and submodule' '
|
||||
echo "(1|2)d(3|4)" >a &&
|
||||
mkdir b &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue