Re: [PATCH v6 06/10] submodule--helper: add gitdir migration command
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Dec 16, 2025, 09:09 UTC
- Message-ID
- <aUEh5fclig8NYmEU@pks.im>
- In-Reply-To
- <20251213080817.347922-7-adrian.ratiu@collabora.com>
On Sat, Dec 13, 2025 at 10:08:12AM +0200, Adrian Ratiu wrote:
Show 24 quoted lines
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 2b5b4f575b..458dc863df 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -1270,6 +1270,63 @@ static int module_gitdir(int argc, const char **argv, const char *prefix UNUSED,
> return 0;
> }
>
> +static int module_migrate(int argc UNUSED, const char **argv UNUSED,
> + const char *prefix UNUSED, struct repository *repo)
> +{
> + struct strbuf module_dir = STRBUF_INIT;
> + DIR *dir;
> + struct dirent *de;
> +
> + if (repo_config_set_gently(repo, "core.repositoryformatversion", "1"))
> + die(_("could not set core.repositoryformatversion to 1. "
> + "Please enable it for migration to work, for example: "
> + "git config core.repositoryformatversion 1"));
> +
> + if (repo_config_set_gently(repo, "extensions.submodulePathConfig", "true"))
> + die(_("could not enable submodulePathConfig extension. It is required "
> + "for migration to work. Please enable it in the root repo: "
> + "git config extensions.submodulePathConfig true"));I think we should reverse the ordering here and first create the "gitdir" config entries before we enable the extension itself. This ensures that a halfway-aborted migration will still leave us in a good state, as the config entries will be ignored until the extension is enabled.
Patrick