submodule--helper: show usage for "-h"
authorJeff King <peff@peff.net>
Tue, 30 May 2017 05:16:50 +0000 (01:16 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 May 2017 05:45:04 +0000 (14:45 +0900)
Normal users shouldn't ever call submodule--helper, but it
doesn't hurt to give them a normal usage message if they try
"-h".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
index 566a5b6a6f8937742e83577918a94f0dcb20c66c..a78b003c25ba95a4030499d21dac6b5f6a43dec9 100644 (file)
@@ -1222,9 +1222,8 @@ static struct cmd_struct commands[] = {
 int cmd_submodule__helper(int argc, const char **argv, const char *prefix)
 {
        int i;
-       if (argc < 2)
-               die(_("submodule--helper subcommand must be "
-                     "called with a subcommand"));
+       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)) {