aboutsummaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/setup.c b/setup.c
index b723f8b339..11fe7f8841 100644
--- a/setup.c
+++ b/setup.c
@@ -686,6 +686,9 @@ static enum extension_result handle_extension(const char *var,
} else if (!strcmp(ext, "relativeworktrees")) {
data->relative_worktrees = git_config_bool(var, value);
return EXTENSION_OK;
+ } else if (!strcmp(ext, "submodulepathconfig")) {
+ data->submodule_path_cfg = git_config_bool(var, value);
+ return EXTENSION_OK;
}
return EXTENSION_UNKNOWN;
}
@@ -1947,6 +1950,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
repo_fmt.worktree_config;
the_repository->repository_format_relative_worktrees =
repo_fmt.relative_worktrees;
+ the_repository->repository_format_submodule_path_cfg =
+ repo_fmt.submodule_path_cfg;
/* take ownership of repo_fmt.partial_clone */
the_repository->repository_format_partial_clone =
repo_fmt.partial_clone;
@@ -2045,6 +2050,8 @@ void check_repository_format(struct repository_format *fmt)
fmt->ref_storage_format);
the_repository->repository_format_worktree_config =
fmt->worktree_config;
+ the_repository->repository_format_submodule_path_cfg =
+ fmt->submodule_path_cfg;
the_repository->repository_format_relative_worktrees =
fmt->relative_worktrees;
the_repository->repository_format_partial_clone =
@@ -2303,6 +2310,7 @@ void initialize_repository_version(int hash_algo,
{
struct strbuf repo_version = STRBUF_INIT;
int target_version = GIT_REPO_VERSION;
+ int default_submodule_path_config = 0;
/*
* Note that we initialize the repository version to 1 when the ref
@@ -2341,6 +2349,15 @@ void initialize_repository_version(int hash_algo,
clear_repository_format(&repo_fmt);
}
+ repo_config_get_bool(the_repository, "init.defaultSubmodulePathConfig",
+ &default_submodule_path_config);
+ if (default_submodule_path_config) {
+ /* extensions.submodulepathconfig requires at least version 1 */
+ if (target_version == 0)
+ target_version = 1;
+ repo_config_set(the_repository, "extensions.submodulepathconfig", "true");
+ }
+
strbuf_addf(&repo_version, "%d", target_version);
repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf);