git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: René Scharfe <l.s.r@web.de>
To: Stefan Beller <sbeller@google.com>, Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>, magnus@homann.se
Subject: Re: [PATCH] pull: honor submodule.recurse config option
Date: Fri, 1 Sep 2017 20:15:40 +0200
Message-ID: <6edd3cff-e552-787e-9ca4-0d91df8e51e0@web.de> (raw)
In-Reply-To: <CAGZ79kaxSARkh9+PrYB05+Ln=hngu-9_y+UYi=P+M0OzNdedNw@mail.gmail.com>

Am 01.09.2017 um 19:11 schrieb Stefan Beller:
> On Fri, Sep 1, 2017 at 12:29 AM, Nicolas Morey-Chaisemartin
> <nicolas@morey-chaisemartin.com> wrote:
>> git pull used to not parse the submodule.recurse config option and simply
>> consider the --recurse-submodules CLI option.
>> When using the config option, submodules would only be fetched recursively
>> while the CLi option would tigger both fetch and update/merge.
>>
>> Reported-by: Magnus Homann <magnus@homann.se>
>> Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
> 
> Reviewed-by: Stefan Beller <sbeller@google.com>
> 
> Thanks,
> Stefan
> 
> 
>> ---
>>   builtin/pull.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/builtin/pull.c b/builtin/pull.c
>> index 7fe281414..e4edf23c5 100644
>> --- a/builtin/pull.c
>> +++ b/builtin/pull.c
>> @@ -326,6 +326,11 @@ static int git_pull_config(const char *var, const char *value, void *cb)
>>                  config_autostash = git_config_bool(var, value);
>>                  return 0;
>>          }
>> +       if (!strcmp(var, "submodule.recurse")) {
>> +               int r = git_config_bool(var, value) ?
>> +                       RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF;>> +               recurse_submodules = r;

A few nits to pick:

Why not assign directly to recurse_submodules?  The variable r is only
set once and read once, and doesn't have a particularly descriptive name
that would justify having it.

builtin/fetch.c::git_fetch_config(), builtin/push.c::git_push_config()
and submodule.c::git_default_submodule_config() do the same, and I can't
infer why for them either.

And why fall through to git_default_config() here even though we know
that it won't match "submodule.recurse" again?  Config functions are
usually exit early on finding a match, as the "rebase.autostash" handler
above does.

>> +       }
>>          return git_default_config(var, value, cb);
>>   }
>>
>> --
>> 2.14.1.460.g196d2604f
>>

  reply index

Thread overview: 5+ messages in thread (expand / mbox.gz / Atom feed / [top])
2017-09-01  5:39 submodule: --recurse-submodules vs. submodule.recurse=true Magnus Homann
2017-09-01  7:29 ` [PATCH] pull: honor submodule.recurse config option Nicolas Morey-Chaisemartin
2017-09-01 17:11   ` Stefan Beller
2017-09-01 18:15     ` René Scharfe [this message]
2017-09-01 17:28   ` Jonathan Nieder

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=6edd3cff-e552-787e-9ca4-0d91df8e51e0@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=magnus@homann.se \
    --cc=nicolas@morey-chaisemartin.com \
    --cc=sbeller@google.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