summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Morian Sonnet <moriansonnet@gmail.com>2019-06-24 22:26:55 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-06-25 11:17:53 -0700
commit30db18b148c4951deb2c870b5243fb5b18ecb5ed (patch)
tree9775a46275e8c266f075daa1ad4ce3f7d340bb1f /builtin
parentGit 2.20.1 (diff)
downloadtgif-30db18b148c4951deb2c870b5243fb5b18ecb5ed.tar.xz
submodule foreach: fix recursion of options
Calling git submodule foreach --recursive <subcommand> --<option> leads to an error stating that the option --<option> is unknown to submodule--helper. That is of course only, when <option> is not a valid option for git submodule foreach. The reason for this is, that above call is internally translated into a call to submodule--helper: git submodule--helper foreach --recursive \ -- <subcommand> --<option> This call starts by executing the subcommand with its option inside the first level submodule and continues by calling the next iteration of the submodule foreach call git --super-prefix <submodulepath> submodule--helper \ foreach --recursive <subcommand> --<option> inside the first level submodule. Note that the double dash in front of the subcommand is missing. This problem starts to arise only recently, as the PARSE_OPT_KEEP_UNKNOWN flag for the argument parsing of git submodule foreach was removed in commit a282f5a906. Hence, the unknown option is complained about now, as the argument parsing is not properly ended by the double dash. This commit fixes the problem by adding the double dash in front of the subcommand during the recursion. Signed-off-by: Morian Sonnet <moriansonnet@googlemail.com> Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/submodule--helper.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d38113a31a..61a5bfb1f2 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -539,6 +539,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
if (info->quiet)
argv_array_push(&cpr.args, "--quiet");
+ argv_array_push(&cpr.args, "--");
argv_array_pushv(&cpr.args, info->argv);
if (run_command(&cpr))