From: Patrick Steinhardt Date: Tue, 06 Jan 2026 07:25:50 GMT Subject: Re: [PATCH v7 05/11] submodule: allow runtime enabling extensions.submodulePathConfig Message-ID: In-Reply-To: <20251220101528.1227487-6-adrian.ratiu@collabora.com> On Sat, Dec 20, 2025 at 12:15:22PM +0200, Adrian Ratiu wrote: > diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc > index e45b2a8121..293a2ddbdf 100644 > --- a/Documentation/config/init.adoc > +++ b/Documentation/config/init.adoc > @@ -18,3 +18,9 @@ endif::[] > See `--ref-format=` in linkgit:git-init[1]. Both the command line > option and the `GIT_DEFAULT_REF_FORMAT` environment variable take > precedence over this config. > + > +init.autoSetupSubmodulePathConfig:: > + A boolean that specifies if `git init` and `git clone` should > + automatically set `extensions.submodulePathConfig` to `true`. This > + allows all new repositories to automatically use the submodule path > + extension. Defaults to `false` when unset. Nit: I would have called this `init.defaultSubmodulePathConfig` so that it fits in better with the other configuration we have that impatcs how we set up repository extensions. > diff --git a/setup.c b/setup.c > index 428427d689..3e05fe7c58 100644 > --- a/setup.c > +++ b/setup.c > @@ -2712,6 +2712,16 @@ int init_db(const char *git_dir, const char *real_git_dir, > initial_branch, flags & INIT_DB_QUIET); > create_object_directory(); > > + repo_config_get_bool(the_repository, "init.autoSetupSubmodulePathConfig", > + &auto_setup_submodule_path_config); > + if (auto_setup_submodule_path_config) { > + int version = 0; > + repo_config_get_int(the_repository, "core.repositoryformatversion", &version); > + if (version < 1) > + repo_config_set(the_repository, "core.repositoryformatversion", "1"); > + repo_config_set(the_repository, "extensions.submodulepathconfig", "true"); > + } > + > if (repo_settings_get_shared_repository(the_repository)) { > char buf[10]; > /* We do not spell "group" and such, so that I think that this logic woudl be better located in `initialize_repository_version()`, which is also where we set up all the other extensions. Feel free to disregard though in case there's a good reason you don't do it there. Patrick