Re: [PATCH 11/15] diff: ignore submodules excluded by groups
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 29, 2016, 18:37 UTC
- Message-ID
- <xmqqlh3wxnuq.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1461703833-10350-12-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 8 quoted lines
> We do not need to do anything special to initialize the `submodule_groups` > pointer as the diff options setup will fill in 0 by default. > > Signed-off-by: Stefan Beller <sbeller@google.com> > --- > diff.c | 3 +++ > diff.h | 1 + > 2 files changed, 4 insertions(+)
Isn't this going in the opposite way from what you described in 0/15 with analogy to how "ignore" mechanism works? Just like a path is tracked once it is tracked, whether it matches an ignore pattern, shouldn't we be getting a summary for a submodule for any submodule once submodule/.git/HEAD is there (i.e. we can give a comparison), whether it is specified by a separate mechanism that acts from sideways (e.g. the "default group").
Show 30 quoted lines
> diff --git a/diff.c b/diff.c
> index 059123c..5808d8a 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -4921,10 +4921,13 @@ static int is_submodule_ignored(const char *path, struct diff_options *options)
> {
> int ignored = 0;
> unsigned orig_flags = options->flags;
> + const struct submodule *sub = submodule_from_path(null_sha1, path);
> if (!DIFF_OPT_TST(options, OVERRIDE_SUBMODULE_CONFIG))
> set_diffopt_flags_from_submodule_config(options, path);
> if (DIFF_OPT_TST(options, IGNORE_SUBMODULES))
> ignored = 1;
> + if (!submodule_in_group(options->submodule_groups, sub))
> + ignored = 1;
> options->flags = orig_flags;
> return ignored;
> }
> diff --git a/diff.h b/diff.h
> index e7d68ed..7d499fb 100644
> --- a/diff.h
> +++ b/diff.h
> @@ -178,6 +178,7 @@ struct diff_options {
> void *output_prefix_data;
>
> int diff_path_counter;
> + struct string_list *submodule_groups;
> };
>
> enum color_diff {