From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Markus Klein via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Markus Klein <masmiseim@gmx.de>
Subject: Re: [PATCH v2] clone: use submodules.recurse option for automatically clone submodules
Date: Fri, 7 Feb 2020 16:45:42 +0100 (CET) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.2002071621160.3718@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <xmqq1rr7fsh3.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Thu, 6 Feb 2020, Junio C Hamano wrote:
> "Markus Klein via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > +static int git_clone_config(const char *var, const char *value, void *cb)
> > +{
> > + if (!strcmp(var, "submodule.recurse") && git_config_bool(var, value)) {
> > + string_list_append(&option_recurse_submodules, "true");
> > + return 0;
>
> The breakage of this is not apparent, but this is misleading. If
> submodule.recurse is set to a value that git_config_bool() would say
> "false", the if statement is skipped, and you end up calling
> git_default_config() with "submodule.recurse", even though you are
> supposed to have already dealt with the setting.
>
> if (!strcmp(var, "submodule.recurse")) {
> if (git_config_bool(var, value))
> ...
> return 0; /* done with the variable either way */
> }
>
> is more appropriate.
Good catch, and I think you will have to do even more: in the "else" case,
it is possible that the user overrode a `submodule.recurse` from the
system config in their user-wide config, so we must _undo_ the
`string_list_append().
Further, it is probably not a good idea to append "true" _twice_ if
multiple configs in the chain specify `submodule.recurse = true`.
> I still do not know what this code is trying to do by appending "true"
> as many times as submodule.recurse appears in the configuration file(s),
> though.
>
> When given from the command line, i.e.
>
> git clone --no-recurse-submodules ...
> git clone --recurse-submodules ...
> git clone --recurse-submodules=<something> ...
>
> recurse_submodules_cb() reacts to them by
>
> (1) clearing what have been accumulated so far,
> (2) appending the match-all "." pathspec, and
> (3) appending the <something> string
>
> to option_recurse_submodules string list. But given that
> submodule.recurse is not (and will not be without an involved
> transition plan) a pathspec but merely a boolean, I would think
> appending hardcoded string constant "true" makes little sense.
> After sorting the list, these values become values of the
> submodule.active configuration variable whose values are pathspec
> elements in cmd_clone(); see the part of the code before it makes a
> call to init_db().
Indeed, I think I even pointed out that "true" is not an appropriate value
to use here: https://github.com/git/git/pull/695/#discussion_r367866708
Ciao,
Dscho
next prev parent reply other threads:[~2020-02-07 15:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 21:11 [PATCH] clone: use submodules.recurse option for automatically clone submodules Markus Klein via GitGitGadget
2020-02-01 21:19 ` Johannes Schindelin
2020-02-04 21:32 ` [PATCH v2] " Markus Klein via GitGitGadget
2020-02-05 10:37 ` Johannes Schindelin
2020-02-06 19:03 ` Junio C Hamano
2020-02-07 15:45 ` Johannes Schindelin [this message]
2020-02-07 18:17 ` Junio C Hamano
2020-02-07 18:33 ` Junio C Hamano
2020-02-24 22:19 ` AW: " masmiseim
2020-02-24 23:06 ` [PATCH v3] clone: use submodule.recurse " Markus Klein via GitGitGadget
2020-05-01 13:54 ` [PATCH v4] " Markus Klein via GitGitGadget
Reply instructions:
You may reply publicly 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 using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.QRO.7.76.6.2002071621160.3718@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=masmiseim@gmx.de \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).