From c349bad72969d59758e1294b4e9964dccd967fa0 Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Mon, 12 Jan 2026 20:46:26 +0200 Subject: 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 Suggested-by: Junio C Hamano Signed-off-by: Adrian Ratiu Signed-off-by: Junio C Hamano --- setup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'setup.c') diff --git a/setup.c b/setup.c index 207fa36e10..3f91a4aaec 100644 --- a/setup.c +++ b/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); -- cgit v1.3