Stefan Beller <sbel...@google.com> writes:

> 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 <sbel...@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").

> 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 {
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to