Re: [PATCH] fetch: Ensure that fetch.recurseSubmodules overrides submodule.recurse.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 21, 2018 at 12:00 PM Marc Branchaud <marcnarc@xxxxxxxxxxx> wrote:
>
> Also document this fact.
>
> Signed-off-by: Marc Branchaud <marcnarc@xxxxxxxxxxx>
> ---
>
> I ran into this bug when I had both fetch.recurseSubmodules=on-demand and
> submodule.recurse=true, and submodule.recurse was set *after*
> fetch.recurseSubmodules in my config.
>
> The fix ensures that fetch.recurseSubmodules always overrides
> submodule.recurse.  If neither is set then fetch still behaves as if
> fetch.recurseSubmodules=on-demand (the documented default).

At least the second paragraph is valuable information in the commit
message, so maybe add it there? I am not sure if the first paragraph is
a good part for the commit message, but maybe helps for writing a test?

> +       reference.  This option overrides the more general submodule.recurse
> +       option, for the `fetch` command.
>
>  fetch.fsckObjects::
>         If it is set to true, git-fetch-pack will check all fetched
> @@ -3465,7 +3466,8 @@ submodule.active::
>  submodule.recurse::
>         Specifies if commands recurse into submodules by default. This
>         applies to all commands that have a `--recurse-submodules` option,
> -       except `clone`.
> +       except `clone`.  Also, the `fetch` command's behaviour can be specified
> +       independently with the fetch.recurseSubmodules option.

There is also push.recurseSubmodules, which should behave similarly?

The series that introduced submodule.recurse ends with 58f4203e7db
(builtin/fetch.c: respect 'submodule.recurse' option, 2017-05-31)
(sb/submodule-blanket-recursive)
seems to have overlooked this only for fetch/push, as the other
commands (checkout, read-tree, reset, grep) do not have their
own specific setting to recurse.


> @@ -88,6 +90,7 @@ static int git_fetch_config(const char *k, const char *v, void *cb)
>                 max_children = parse_submodule_fetchjobs(k, v);
>                 return 0;
>         } else if (!strcmp(k, "fetch.recursesubmodules")) {
> +               recurse_submodules_set_explicitly = 1;

the command line option also overried explicitely, but that
is ensured via the program flow (parse_config happens after
git_config to overlay options, which itself was pre-seeded
with fetch_config_from_gitmodules).

I briefly wondered if this overlaying approach would be better
(i.e. first do git_config with more generic option, and then
again with the more detailed option) as it would save one
global variable, but the downsides are terrible (way more
work to do, more code and such), so I think having a global
makes sense and gets the job done.

Ideally instead of a global we'd have this flag stored in
the repository struct, as eventually in the long run,
fetch_populated_submodules could happen in-process
instead of spawning fetch processes for each submodule
(and their nested submodules which may be configured
differently). But for now the global will do.

Thanks!
Stefan



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux