mirror of
https://github.com/git/git.git
synced 2026-08-09 01:21:47 +00:00
submodule: allow runtime enabling extensions.submodulePathConfig
Add a new config `init.defaultSubmodulePathConfig` which allows enabling `extensions.submodulePathConfig` for new submodules by default (those created via git init or clone). Important: setting init.defaultSubmodulePathConfig = true does not globally enable `extensions.submodulePathConfig`. Existing repositories will still have the extension disabled and will require migration (for example via git submodule--helper command added in the next commit). Suggested-by: Patrick Steinhardt <ps@pks.im> Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4173df5187
commit
c349bad729
10
setup.c
10
setup.c
@@ -2228,6 +2228,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
|
||||
@@ -2266,6 +2267,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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user