@@ -449,7 +449,8 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
};
argc = parse_options(argc, argv, prefix, module_foreach_options,
- git_submodule_helper_usage, 0);
+ git_submodule_helper_usage,
+ PARSE_OPT_STOP_AT_NON_OPTION);
if (module_list_compute(0, NULL, prefix, &pathspec, &list) < 0)
return 1;
@@ -47,37 +47,6 @@ jobs=
recommend_shallow=
filter=
-
-# Execute an arbitrary command sequence in each checked out
-# submodule
-#
-# $@ = command to execute
-#
-cmd_foreach()
-{
- # parse $args after "submodule ... foreach".
- while test $# -ne 0
- do
- case "$1" in
- -q|--quiet)
- GIT_QUIET=1
- ;;
- --recursive)
- recursive=1
- ;;
- -*)
- usage
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach ${GIT_QUIET:+--quiet} ${recursive:+--recursive} -- "$@"
-}
-
#
# Update each submodule path to correct revision, using clone and checkout as needed
#
@@ -262,10 +231,10 @@ case "$command" in
absorbgitdirs)
git submodule--helper "$command" --prefix "$wt_prefix" "$@"
;;
-foreach | update)
- "cmd_$command" "$@"
+update)
+ cmd_update "$@"
;;
-add | init | deinit | set-branch | set-url | status | summary | sync)
+add | foreach | init | deinit | set-branch | set-url | status | summary | sync)
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper "$command" \
${GIT_QUIET:+--quiet} ${cached:+--cached} "$@"
;;
Dispatch the "git submodule foreach" command directly to "git submodule--helper foreach". This case requires the addition of the PARSE_OPT_STOP_AT_NON_OPTION flag, since the shellscript was unconditionally adding "--" to the "git submodule--helper" command-line. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/submodule--helper.c | 3 ++- git-submodule.sh | 37 +++---------------------------------- 2 files changed, 5 insertions(+), 35 deletions(-)