Remove the $prefix variable which isn't used anymore, and hasn't been since b3c5f5cb048 (submodule: move core cmd_update() logic to C, 2022-03-15). Before that we'd use it to invoke "git submodule--helper" with the "--recursive-prefix" option, but since b3c5f5cb048 that "git submodule--helper" option is only used when it invokes itself. Since we haven't used it since then we haven't been passing the --super-prefix option to "git submodule--helper", and can therefore remove the handling of it from builtin/submodule--helper.c as well. Note also that the still-existing code in builtin/submodule--helper.c to invoke other "git submodule--helper" processes with "--super-prefix" is not passing the option to "cmd_submodule__helper()", rather it's an argument to "git" itself. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- builtin/submodule--helper.c | 53 +++++++++++++++---------------------- git-submodule.sh | 6 ++--- 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 5c77dfcffee..9d3642290f3 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -3364,35 +3364,32 @@ static int module_add(int argc, const char **argv, const char *prefix) return 0; } -#define SUPPORT_SUPER_PREFIX (1<<0) - struct cmd_struct { const char *cmd; int (*fn)(int, const char **, const char *); - unsigned option; }; static struct cmd_struct commands[] = { - {"list", module_list, 0}, - {"name", module_name, 0}, - {"clone", module_clone, 0}, - {"add", module_add, SUPPORT_SUPER_PREFIX}, - {"update", module_update, 0}, - {"resolve-relative-url-test", resolve_relative_url_test, 0}, - {"foreach", module_foreach, SUPPORT_SUPER_PREFIX}, - {"init", module_init, SUPPORT_SUPER_PREFIX}, - {"status", module_status, SUPPORT_SUPER_PREFIX}, - {"sync", module_sync, SUPPORT_SUPER_PREFIX}, - {"deinit", module_deinit, 0}, - {"summary", module_summary, SUPPORT_SUPER_PREFIX}, - {"push-check", push_check, 0}, - {"absorb-git-dirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX}, - {"is-active", is_active, 0}, - {"check-name", check_name, 0}, - {"config", module_config, 0}, - {"set-url", module_set_url, 0}, - {"set-branch", module_set_branch, 0}, - {"create-branch", module_create_branch, 0}, + {"list", module_list}, + {"name", module_name}, + {"clone", module_clone}, + {"add", module_add}, + {"update", module_update}, + {"resolve-relative-url-test", resolve_relative_url_test}, + {"foreach", module_foreach}, + {"init", module_init}, + {"status", module_status}, + {"sync", module_sync}, + {"deinit", module_deinit}, + {"summary", module_summary}, + {"push-check", push_check}, + {"absorb-git-dirs", absorb_git_dirs}, + {"is-active", is_active}, + {"check-name", check_name}, + {"config", module_config}, + {"set-url", module_set_url}, + {"set-branch", module_set_branch}, + {"create-branch", module_create_branch}, }; int cmd_submodule__helper(int argc, const char **argv, const char *prefix) @@ -3401,15 +3398,9 @@ int cmd_submodule__helper(int argc, const char **argv, const char *prefix) if (argc < 2 || !strcmp(argv[1], "-h")) usage("git submodule--helper <command>"); - for (i = 0; i < ARRAY_SIZE(commands); i++) { - if (!strcmp(argv[1], commands[i].cmd)) { - if (get_super_prefix() && - !(commands[i].option & SUPPORT_SUPER_PREFIX)) - die(_("%s doesn't support --super-prefix"), - commands[i].cmd); + for (i = 0; i < ARRAY_SIZE(commands); i++) + if (!strcmp(argv[1], commands[i].cmd)) return commands[i].fn(argc - 1, argv + 1, prefix); - } - } die(_("'%s' is not a valid submodule--helper " "subcommand"), argv[1]); diff --git a/git-submodule.sh b/git-submodule.sh index bc436c4ca47..53847bbf6e2 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -41,7 +41,6 @@ files= remote= nofetch= update= -prefix= custom_name= depth= progress= @@ -127,7 +126,7 @@ cmd_add() usage fi - git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper add ${GIT_QUIET:+--quiet} ${force:+--force} ${progress:+"--progress"} ${branch:+--branch "$branch"} ${reference_path:+--reference "$reference_path"} ${dissociate:+--dissociate} ${custom_name:+--name "$custom_name"} ${depth:+"$depth"} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper add ${GIT_QUIET:+--quiet} ${force:+--force} ${progress:+"--progress"} ${branch:+--branch "$branch"} ${reference_path:+--reference "$reference_path"} ${dissociate:+--dissociate} ${custom_name:+--name "$custom_name"} ${depth:+"$depth"} -- "$@" } # @@ -189,7 +188,7 @@ cmd_init() shift done - git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper init ${GIT_QUIET:+--quiet} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init ${GIT_QUIET:+--quiet} -- "$@" } # @@ -346,7 +345,6 @@ cmd_update() ${init:+--init} \ ${nofetch:+--no-fetch} \ ${wt_prefix:+--prefix "$wt_prefix"} \ - ${prefix:+--recursive-prefix "$prefix"} \ ${update:+--update "$update"} \ ${reference:+"$reference"} \ ${dissociate:+"--dissociate"} \ -- 2.36.1.1239.gfba91521d90