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

Re: [PATCH v2] pull: only pass '--recurse-submodules' to subcommands

From
Philippe Blain <levraiphilippeblain@gmail.com>
Date
May 11, 2022, 22:30 UTC
Message-ID
<deafd5db-6303-46b3-a5d5-b4117ba16781@gmail.com>
In-Reply-To
<pull.1262.v2.git.git.1652210747614.gitgitgadget@gmail.com>
Hi Glen,
Le 2022-05-10 à 15:25, Glen Choo via GitGitGadget a écrit :
Show 44 quoted lines
> From: Glen Choo <chooglen@google.com>
> 
> Fix a bug in "git pull" where `submodule.recurse` is preferred over
> `fetch.recurseSubmodules` when performing a fetch
> (Documentation/config/fetch.txt says that `fetch.recurseSubmodules`
> should be preferred.). Do this by passing the value of the
> "--recurse-submodules" CLI option to the underlying fetch, instead of
> passing a value that combines the CLI option and config variables.
> 
> In other words, this bug occurred because builtin/pull.c is conflating
> two similar-sounding, but different concepts:
> 
> - Whether "git pull" itself should care about submodules e.g. whether it
>   should update the submodule worktrees after performing a merge.
> - The value of "--recurse-submodules" to pass to the underlying "git
>   fetch".
> 
> Thus, when `submodule.recurse` is set, the underlying "git fetch" gets
> invoked with "--recurse-submodules[=value]", overriding the value of
> `fetch.recurseSubmodules`.
> 
> An alternative (and more obvious) approach to fix the bug would be to
> teach "git pull" to understand `fetch.recurseSubmodules`, but the
> proposed solution works better because:
> 
> - We don't maintain two identical config-parsing implementions in "git
>   pull" and "git fetch".
> - It works better with other commands invoked by "git pull" e.g. "git
>   merge" won't accidentally respect `fetch.recurseSubmodules`.
> 
> Reported-by: Huang Zou <huang.zou@schrodinger.com>
> Helped-by: Philippe Blain <levraiphilippeblain@gmail.com>
> Signed-off-by: Glen Choo <chooglen@google.com>
> ---
>     pull: only pass '--recurse-submodules' to subcommands
>     
>     Thanks for the debugging help :)
>     
>     Changes since v1:
>     
>      * add a test that actually tests the precedence of the config values
>        * I've kept the previous test; it has always worked, but it still
>          seems like a useful smoke test
>      * reworded the commit message slightly

Thanks, this version looks good to me. I don't feel to strongly about the title either, so as you wish :)

Philippe.
Previous: Glen Choo via GitGitGadgetNext: Junio C Hamano
Message 8 of 15 in “pull: only pass '--recurse-submodules' to subcommands”
  1. pull: only pass '--recurse-submodules' to subcommandsGlen Choo via GitGitGadget, May 9, 2022
  2. Junio C HamanoMay 10, 2022
  3. Junio C HamanoMay 10, 2022
  4. Philippe BlainMay 10, 2022
  5. Glen ChooMay 10, 2022
  6. Glen ChooMay 10, 2022
  7. pull: only pass '--recurse-submodules' to subcommandsGlen Choo via GitGitGadget, May 10, 2022
  8. Philippe BlainMay 11, 2022
  9. Junio C HamanoMay 11, 2022
  10. Philippe BlainMay 11, 2022
  11. Glen ChooMay 11, 2022
  12. Junio C HamanoMay 12, 2022
  13. pull: do not let submodule.recurse override fetch.recurseSubmodulesGlen Choo via GitGitGadget, May 11, 2022
  14. Junio C HamanoMay 12, 2022
  15. Philippe BlainMay 12, 2022

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.