Re: [PATCH 07/15] submodule: don't rely on overlayed config when setting diffopts
- From
Stefan Beller <sbeller@google.com>
- Date
- Jul 25, 2017, 23:46 UTC
- Message-ID
- <CAGZ79kZ24eT6kyLE6W8PTQwCy3gJWUaexFCOdQrQbS5tPEAmsg@mail.gmail.com>
- In-Reply-To
- <20170725213928.125998-8-bmwill@google.com>
On Tue, Jul 25, 2017 at 2:39 PM, Brandon Williams <bmwill@google.com> wrote:
Show 25 quoted lines
> Don't rely on overlaying the repository's config on top of the
> submodule-config, instead query the repository's config directory for
> the ignore field.
>
> Signed-off-by: Brandon Williams <bmwill@google.com>
> ---
> submodule.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/submodule.c b/submodule.c
> index c5058a4b8..f86b82fbb 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -165,8 +165,16 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
> {
> const struct submodule *submodule = submodule_from_path(&null_oid, path);
> if (submodule) {
> - if (submodule->ignore)
> - handle_ignore_submodules_arg(diffopt, submodule->ignore);
> + const char *ignore;
> + char *key;
> +
> + key = xstrfmt("submodule.%s.ignore", submodule->name);
> + if (repo_config_get_string_const(the_repository, key, &ignore))
> + ignore = submodule->ignore;Unlike the last patch, we have to use a direct lookup here as the alternative is hugely painful.
Show 10 quoted lines
> + free(key); > + > + if (ignore) > + handle_ignore_submodules_arg(diffopt, ignore); > else if (is_gitmodules_unmerged(&the_index)) > DIFF_OPT_SET(diffopt, IGNORE_SUBMODULES); > } > -- > 2.14.0.rc0.400.g1c36432dff-goog >