git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Stefan Beller <sbeller@google.com>
Date
Sep 21, 2018, 19:22 UTC
Message-ID
<CAGZ79kabCTD9uvw+GPXxJGf8BfiqvMkhkA4Up8gC_kXjdv-o8g@mail.gmail.com>
In-Reply-To
<20180921185149.8670-1-marcnarc@xiplink.com>
On Fri, Sep 21, 2018 at 12:00 PM Marc Branchaud <marcnarc@xiplink.com> wrote:
Show 13 quoted lines
>
> Also document this fact.
>
> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
> ---
>
> 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?

Show 12 quoted lines
> +       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.

Show 5 quoted lines
> @@ -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

Previous: Marc Branchaud
Message 2 of 2 in “fetch: Ensure that fetch.recurseSubmodules overrides submodule.recurse.”
  1. fetch: Ensure that fetch.recurseSubmodules overrides submodule.recurse.Marc Branchaud, Sep 21, 2018
  2. Stefan BellerSep 21, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.