From: Ævar Arnfjörð Bjarmason Date: Fri, 10 Jun 2022 02:01:20 GMT Subject: [RFC PATCH 08/20] submodule--helper: pretend to be "git submodule" in "-h" output Message-ID: In-Reply-To: Change the usage output for "git submodule--helper" so that it will pretend to be named "git submodule". This will allow us to dispatch further into "git submodule--helper" from git-submodule.sh while emitting the correct usage output. This fixes a bug that's been there ever since "git submodule absorbgitdirs" was added in f6f85861400 (submodule: add absorb-git-dir function, 2016-12-12). Before this we'd emit e.g. this on invalid usage: $ git submodule absorbgitdirs --blah error: unknown option `blah' usage: git submodule--helper absorbgitdirs [] [...] Now we'll emit the same, except that the usage line is now referring to the correct command run by the user: usage: git submodule absorbgitdirs [] [...] [.. same usage output ...] Note that in the case of "status", "deinit" and "update" we were already referring to ourselves as "git submodule" in builtin/submodule--helper.c. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/submodule--helper.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 8df1541baf8..3173295ed8e 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -286,7 +286,7 @@ static int module_list(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper list [--prefix=] [...]"), + N_("git submodule list [--prefix=] [...]"), NULL }; @@ -444,7 +444,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper foreach [--quiet] [--recursive] [--] "), + N_("git submodule foreach [--quiet] [--recursive] [--] "), NULL }; @@ -582,7 +582,7 @@ static int module_init(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper init [] []"), + N_("git submodule init [] []"), NULL }; @@ -786,7 +786,7 @@ static int module_name(int argc, const char **argv, const char *prefix) const struct submodule *sub; if (argc != 2) - usage(_("git submodule--helper name ")); + usage(_("git submodule name ")); sub = submodule_from_path(the_repository, null_oid(), argv[1]); @@ -1185,7 +1185,7 @@ static int module_summary(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper summary [] [] [--] []"), + N_("git submodule summary [] [] [--] []"), NULL }; @@ -1349,7 +1349,7 @@ static int module_sync(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper sync [--quiet] [--recursive] []"), + N_("git submodule sync [--quiet] [--recursive] []"), NULL }; @@ -1789,7 +1789,7 @@ static int module_clone(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper clone [--prefix=] [--quiet] " + N_("git submodule clone [--prefix=] [--quiet] " "[--reference ] [--name ] [--depth ] " "[--single-branch] [--filter ] " "--url --path "), @@ -2784,7 +2784,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper absorbgitdirs [] [...]"), + N_("git submodule absorbgitdirs [] [...]"), NULL }; @@ -2848,9 +2848,9 @@ static int module_config(int argc, const char **argv, const char *prefix) OPT_END() }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper config []"), - N_("git submodule--helper config --unset "), - "git submodule--helper config --check-writeable", + N_("git submodule config []"), + N_("git submodule config --unset "), + "git submodule config --check-writeable", NULL }; @@ -2889,7 +2889,7 @@ static int module_set_url(int argc, const char **argv, const char *prefix) OPT_END() }; const char *const usage[] = { - N_("git submodule--helper set-url [--quiet] "), + N_("git submodule set-url [--quiet] "), NULL }; @@ -2928,8 +2928,8 @@ static int module_set_branch(int argc, const char **argv, const char *prefix) OPT_END() }; const char *const usage[] = { - N_("git submodule--helper set-branch [-q|--quiet] (-d|--default) "), - N_("git submodule--helper set-branch [-q|--quiet] (-b|--branch) "), + N_("git submodule set-branch [-q|--quiet] (-d|--default) "), + N_("git submodule set-branch [-q|--quiet] (-b|--branch) "), NULL }; @@ -2970,7 +2970,7 @@ static int module_create_branch(int argc, const char **argv, const char *prefix) OPT_END() }; const char *const usage[] = { - N_("git submodule--helper create-branch [-f|--force] [--create-reflog] [-q|--quiet] [-t|--track] [-n|--dry-run] "), + N_("git submodule create-branch [-f|--force] [--create-reflog] [-q|--quiet] [-t|--track] [-n|--dry-run] "), NULL }; @@ -3273,7 +3273,7 @@ static int module_add(int argc, const char **argv, const char *prefix) }; const char *const usage[] = { - N_("git submodule--helper add [] [--] []"), + N_("git submodule add [] [--] []"), NULL }; -- 2.36.1.1178.gb5b1747c546