submodule--helper: report "submodule" as our name in some "-h" output

Change the user-facing "git submodule--helper" commands so that they'll report their name as being "git submodule". To a user these commands are internal implementation details, and it doesn't make sense to emit usage about an internal helper when "git submodule" is invoked with invalid options. Before this we'd emit e.g.: $ git submodule absorbgitdirs --blah error: unknown option `blah' usage: git submodule--helper absorbgitdirs [<options>] [<path>...] [...] And: $ git submodule set-url -- -- usage: git submodule--helper set-url [--quiet] <path> <newurl> [...] Now we'll start with "usage: git submodule [...]" in both of those cases. This change does not alter the "list", "name", "clone", "config" and "create-branch" commands, those are internal-only (as an aside; their usage info should probably invoke BUG(...)). This only changes the user-facing commands. The "status", "deinit" and "update" commands are not included in this change, because their usage information already used "submodule" rather than "submodule--helper". I don't think it's currently possible to emit some of this usage information in practice, as git-submodule.sh will catch unknown options, and e.g. it doesn't seem to be possible to get "add" to emit its usage information from "submodule--helper". Though that change may be superfluous now, it's also harmless, and will allow us to eventually dispatch further into "git submodule--helper" from git-submodule.sh, while emitting the correct usage output. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jun 28, 2022 at 12:05 UTC 36d45163b6de05886c2c6feb2e626ce423b96b3b
1 file changed +9 -9
builtin/submodule--helper.c
+9 -9
@@ -444,7 +444,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
444 };
445
446 const char *const git_submodule_helper_usage[] = {
447 - N_("git submodule--helper foreach [--quiet] [--recursive] [--] <command>"),
447 + N_("git submodule foreach [--quiet] [--recursive] [--] <command>"),
448 NULL
449 };
450
@@ -582,7 +582,7 @@ static int module_init(int argc, const char **argv, const char *prefix)
582 };
583
584 const char *const git_submodule_helper_usage[] = {
585 - N_("git submodule--helper init [<options>] [<path>]"),
585 + N_("git submodule init [<options>] [<path>]"),
586 NULL
587 };
588
@@ -1185,7 +1185,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)
1185 };
1186
1187 const char *const git_submodule_helper_usage[] = {
1188 - N_("git submodule--helper summary [<options>] [<commit>] [--] [<path>]"),
1188 + N_("git submodule summary [<options>] [<commit>] [--] [<path>]"),
1189 NULL
1190 };
1191
@@ -1349,7 +1349,7 @@ static int module_sync(int argc, const char **argv, const char *prefix)
1349 };
1350
1351 const char *const git_submodule_helper_usage[] = {
1352 - N_("git submodule--helper sync [--quiet] [--recursive] [<path>]"),
1352 + N_("git submodule sync [--quiet] [--recursive] [<path>]"),
1353 NULL
1354 };
1355
@@ -2787,7 +2787,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
2787 };
2788
2789 const char *const git_submodule_helper_usage[] = {
2790 - N_("git submodule--helper absorbgitdirs [<options>] [<path>...]"),
2790 + N_("git submodule absorbgitdirs [<options>] [<path>...]"),
2791 NULL
2792 };
2793
@@ -2892,7 +2892,7 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
2892 OPT_END()
2893 };
2894 const char *const usage[] = {
2895 - N_("git submodule--helper set-url [--quiet] <path> <newurl>"),
2895 + N_("git submodule set-url [--quiet] <path> <newurl>"),
2896 NULL
2897 };
2898
@@ -2931,8 +2931,8 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
2931 OPT_END()
2932 };
2933 const char *const usage[] = {
2934 - N_("git submodule--helper set-branch [-q|--quiet] (-d|--default) <path>"),
2935 - N_("git submodule--helper set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
2934 + N_("git submodule set-branch [-q|--quiet] (-d|--default) <path>"),
2935 + N_("git submodule set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
2936 NULL
2937 };
2938
@@ -3276,7 +3276,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
3276 };
3277
3278 const char *const usage[] = {
3279 - N_("git submodule--helper add [<options>] [--] <repository> [<path>]"),
3279 + N_("git submodule add [<options>] [--] <repository> [<path>]"),
3280 NULL
3281 };
3282