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