]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule--helper: report "submodule" as our name in some "-h" output
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 28 Jun 2022 10:05:30 +0000 (12:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Jun 2022 20:13:17 +0000 (13:13 -0700)
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>
builtin/submodule--helper.c

index 1a84ae8efd2a4a26658fa60f96b6cb49cb6ac655..04d2620fce8c2ca33d5fb15fb3c557677e8e0e2e 100644 (file)
@@ -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] [--] <command>"),
+               N_("git submodule foreach [--quiet] [--recursive] [--] <command>"),
                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 [<options>] [<path>]"),
+               N_("git submodule init [<options>] [<path>]"),
                NULL
        };
 
@@ -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 [<options>] [<commit>] [--] [<path>]"),
+               N_("git submodule summary [<options>] [<commit>] [--] [<path>]"),
                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] [<path>]"),
+               N_("git submodule sync [--quiet] [--recursive] [<path>]"),
                NULL
        };
 
@@ -2787,7 +2787,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 [<options>] [<path>...]"),
+               N_("git submodule absorbgitdirs [<options>] [<path>...]"),
                NULL
        };
 
@@ -2892,7 +2892,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] <path> <newurl>"),
+               N_("git submodule set-url [--quiet] <path> <newurl>"),
                NULL
        };
 
@@ -2931,8 +2931,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) <path>"),
-               N_("git submodule--helper set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
+               N_("git submodule set-branch [-q|--quiet] (-d|--default) <path>"),
+               N_("git submodule set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
                NULL
        };
 
@@ -3276,7 +3276,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
        };
 
        const char *const usage[] = {
-               N_("git submodule--helper add [<options>] [--] <repository> [<path>]"),
+               N_("git submodule add [<options>] [--] <repository> [<path>]"),
                NULL
        };