git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Brandon Williams <bmwill@google.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH 06/15] fetch: don't overlay config with submodule-config
Date: Tue, 25 Jul 2017 16:44:04 -0700
Message-ID: <CAGZ79kZGFhiNAYqJ9hZqDLEZt-9jYQ=o0ej2VmO0E=pZg85Fsg@mail.gmail.com> (raw)
In-Reply-To: <20170725213928.125998-7-bmwill@google.com>

On Tue, Jul 25, 2017 at 2:39 PM, Brandon Williams <bmwill@google.com> wrote:
> Don't rely on overlaying the repository's config on top of the
> submodule-config, instead query the repository's config directly for the
> fetch_recurse field.
>
> Signed-off-by: Brandon Williams <bmwill@google.com>

Reviewed-by: Stefan Beller <sbeller@google.com>

> ---
>  builtin/fetch.c |  1 -
>  submodule.c     | 24 +++++++++++++++++-------
>  2 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index d84c26391..3fe99073d 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -1362,7 +1362,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
>
>         if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
>                 gitmodules_config();
> -               git_config(submodule_config, NULL);
>         }
>
>         if (all) {
> diff --git a/submodule.c b/submodule.c
> index 8b9e48a61..c5058a4b8 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -1210,14 +1210,24 @@ static int get_next_submodule(struct child_process *cp,
>
>                 default_argv = "yes";
>                 if (spf->command_line_option == RECURSE_SUBMODULES_DEFAULT) {
> -                       if (submodule &&
> -                           submodule->fetch_recurse !=
> -                                               RECURSE_SUBMODULES_NONE) {
> -                               if (submodule->fetch_recurse ==
> -                                               RECURSE_SUBMODULES_OFF)
> +                       int fetch_recurse = RECURSE_SUBMODULES_NONE;
> +
> +                       if (submodule) {
> +                               char *key;
> +                               const char *value;
> +
> +                               fetch_recurse = submodule->fetch_recurse;
> +                               key = xstrfmt("submodule.%s.fetchRecurseSubmodules", submodule->name);
> +                               if (!repo_config_get_string_const(the_repository, key, &value)) {
> +                                       fetch_recurse = parse_fetch_recurse_submodules_arg(key, value);
> +                               }
> +                               free(key);
> +                       }

I wonder if it would be better to parse this in builtin/fetch.c#git_fetch_config
and then pass it in here as a parameter, instead of looking it up directly here?
That way it is easier to keep track of what a builtin pays attention to.


> +
> +                       if (fetch_recurse != RECURSE_SUBMODULES_NONE) {
> +                               if (fetch_recurse == RECURSE_SUBMODULES_OFF)
>                                         continue;
> -                               if (submodule->fetch_recurse ==
> -                                               RECURSE_SUBMODULES_ON_DEMAND) {
> +                               if (fetch_recurse == RECURSE_SUBMODULES_ON_DEMAND) {
>                                         if (!unsorted_string_list_lookup(&changed_submodule_paths, ce->name))
>                                                 continue;
>                                         default_argv = "on-demand";
> --
> 2.14.0.rc0.400.g1c36432dff-goog
>

  reply index

Thread overview: 61+ messages in thread (expand / mbox.gz / Atom feed / [top])
2017-07-25 21:39 [PATCH 00/15] submodule-config cleanup Brandon Williams
2017-07-25 21:39 ` [PATCH 01/15] t7411: check configuration parsing errors Brandon Williams
2017-07-26 20:56   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-07-25 23:17   ` Stefan Beller
2017-07-26 21:06     ` Junio C Hamano
2017-07-30 13:43       ` Jens Lehmann
2017-07-30 21:25         ` Junio C Hamano
2017-07-31 20:43         ` Stefan Beller
2017-08-11 16:53           ` Heiko Voigt
2017-07-25 21:39 ` [PATCH 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-07-25 23:33   ` Stefan Beller
2017-07-25 23:37     ` Brandon Williams
2017-07-26 21:25     ` Junio C Hamano
2017-07-31 20:50       ` Brandon Williams
2017-07-25 21:39 ` [PATCH 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-07-25 23:35   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-07-25 23:37   ` Stefan Beller
2017-07-25 23:39     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-07-25 23:44   ` Stefan Beller [this message]
2017-07-25 23:48     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-07-25 23:46   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 08/15] unpack-trees: don't rely on overlayed config Brandon Williams
2017-07-25 21:39 ` [PATCH 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-07-26 21:31   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-07-25 21:39 ` [PATCH 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-07-25 21:39 ` [PATCH 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-07-25 21:39 ` [PATCH 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-07-25 21:39 ` [PATCH 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-07-25 21:39 ` [PATCH 15/15] submodule: remove gitmodules_config Brandon Williams
2017-08-03 18:19 ` [PATCH v2 00/15] submodule-config cleanup Brandon Williams
2017-08-03 18:19   ` [PATCH v2 01/15] t7411: check configuration parsing errors Brandon Williams
2017-08-03 18:19   ` [PATCH v2 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-08-03 18:57     ` Stefan Beller
2017-08-04 21:53       ` Brandon Williams
2017-08-11 16:59         ` Heiko Voigt
2017-08-03 20:17     ` Junio C Hamano
2017-08-03 18:19   ` [PATCH v2 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-08-03 18:19   ` [PATCH v2 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-08-03 18:19   ` [PATCH v2 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-08-03 18:19   ` [PATCH v2 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-08-03 18:19   ` [PATCH v2 08/15] unpack-trees: don't respect submodule.update Brandon Williams
2017-08-03 20:26     ` Stefan Beller
2017-08-03 20:37     ` Junio C Hamano
2017-08-03 20:43       ` Stefan Beller
2017-08-03 18:19   ` [PATCH v2 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-08-03 18:19   ` [PATCH v2 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-08-03 20:40     ` Junio C Hamano
2017-08-04 21:59       ` Brandon Williams
2017-08-03 18:19   ` [PATCH v2 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-08-03 18:19   ` [PATCH v2 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-08-03 18:19   ` [PATCH v2 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-08-11 17:18     ` Heiko Voigt
2017-08-03 18:20   ` [PATCH v2 15/15] submodule: remove gitmodules_config Brandon Williams
2017-08-03 20:09   ` [PATCH v2 00/15] submodule-config cleanup Junio C Hamano

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply to all the recipients using the --to, --cc,
  and --in-reply-to switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGZ79kZGFhiNAYqJ9hZqDLEZt-9jYQ=o0ej2VmO0E=pZg85Fsg@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox