Re: [PATCH v2 04/10] submodule--helper: convert "foreach" to its own "--super-prefix"
- From
Glen Choo <chooglen@google.com>
- Date
- Nov 14, 2022, 21:56 UTC
- Message-ID
- <kl6l7czxp5dd.fsf@chooglen-macbookpro.roam.corp.google.com>
- In-Reply-To
- <patch-v2-04.10-935d8070834-20221114T100803Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 29 quoted lines
> As with a preceding commit to convert "absorbgitdirs", we can convert
> "submodule--helper foreach" to use its own "--super-prefix", instead
> of relying on the global "--super-prefix" argument to "git"
> itself. See that earlier commit for the rationale and background.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
> builtin/submodule--helper.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index c4d5e029b37..989c75280af 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -396,7 +398,9 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
> struct foreach_cb info = FOREACH_CB_INIT;
> struct pathspec pathspec = { 0 };
> struct module_list list = MODULE_LIST_INIT;
> + const char *super_prefix = NULL;
> struct option module_foreach_options[] = {
> + OPT__SUPER_PREFIX(&super_prefix),
> OPT__QUIET(&info.quiet, N_("suppress output of entering each submodule command")),
> OPT_BOOL(0, "recursive", &info.recursive,
> N_("recurse into nested submodules")),
> @@ -417,6 +421,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
> info.argc = argc;
> info.argv = argv;
> info.prefix = prefix;
> + info.super_prefix = super_prefix;(Also applies to subsequent patches) Why don't we assign the super prefix directly to the struct's field? e.g.
OPT__SUPER_PREFIX(&info.super_prefix),
> > for_each_listed_submodule(&list, runcommand_in_submodule_cb, &info); >