Address an edge case that "git-submodule.sh" has had all along, but which became painfully obvious in the *.sh to *.c migration in the preceding commit. We didn't support the "--" delimiter in the argument-less invocation. Let's not bend over backwards to behave unusually in this scenario, simply accepting "--" is harmless. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- Documentation/git-submodule.txt | 2 +- builtin/submodule.c | 12 ++---------- t/t7400-submodule-basic.sh | 4 ++-- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt index 4d3ab6b9f92..345ebcafb9c 100644 --- a/Documentation/git-submodule.txt +++ b/Documentation/git-submodule.txt @@ -9,7 +9,7 @@ git-submodule - Initialize, update or inspect submodules SYNOPSIS -------- [verse] -'git submodule' [--quiet] [--cached] +'git submodule' [--quiet] [--cached] [--] 'git submodule' [--quiet] add [<options>] [--] <repository> [<path>] 'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...] 'git submodule' [--quiet] init [--] [<path>...] diff --git a/builtin/submodule.c b/builtin/submodule.c index 7e3499f3376..1d77f2d0964 100644 --- a/builtin/submodule.c +++ b/builtin/submodule.c @@ -8,7 +8,7 @@ #include "strvec.h" #define BUILTIN_SUBMODULE_USAGE \ - "git submodule [--quiet] [--cached]" + "git submodule [--quiet] [--cached] [--]" #define BUILTIN_SUBMODULE_ADD_USAGE \ N_("git submodule [--quiet] add [-b <branch>] [-f | --force] [--name <name>]\n" \ @@ -91,14 +91,6 @@ static void setup_helper_args(int argc, const char **argv, const char *prefix, argv++; argc--; - /* - * This is stupid, but don't support "[--]" to - * subcommand-less "git-submodule" for now. - */ - if (!strcmp(cmd, "--") || !strcmp(cmd, "--end-of-options")) - usage_msg_optf(_("need explicit sub-command name to delimit with '%s'"), - git_submodule_usage, options, cmd); - /* Options that need to go before user-supplied options */ if (!strcmp(cmd, "absorbgitdirs")) do_quiet_cache = 0; @@ -133,7 +125,7 @@ int cmd_submodule(int argc, const char **argv, const char *prefix) }; argc = parse_options(argc, argv, prefix, options, git_submodule_usage, - PARSE_OPT_STOP_AT_NON_OPTION | PARSE_OPT_KEEP_DASHDASH); + PARSE_OPT_STOP_AT_NON_OPTION); /* * Tell the rest of git that any URLs we get don't come diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 19df3407ef1..c524398e805 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -25,8 +25,8 @@ test_expect_success 'submodule usage: --recursive' ' ' test_expect_success 'submodule usage: status --' ' - test_expect_code 129 git submodule -- && - test_expect_code 129 git submodule --end-of-options + git submodule -- && + git submodule --end-of-options ' for opt in '--quiet' -- 2.38.0.1091.gf9d18265e59