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

Re: [PATCH] pull: honor submodule.recurse config option

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Sep 1, 2017, 17:28 UTC
Message-ID
<20170901172815.GA143138@aiede.mtv.corp.google.com>
In-Reply-To
<cc70ea38-9980-120f-afaa-af7a6e3a8c36@morey-chaisemartin.com>
Hi,
Nicolas Morey-Chaisemartin wrote:
Show 7 quoted lines
> 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>
nits:
* Git's commit messages usually use the present tense to describe the
  behavior of Git in absence of a patch, as though writing a bug report.
  They use the imperative mood to describe what the patch will do, as
  though commanding the code to do better.
* spelling: s/CLi/CLI/; s/tigger/trigger/
* please also wrap lines consistently
That would make
	"git pull" supports a --recurse-submodules option but does not parse the
	submodule.recurse configuration item to set the default for that option.
	Meanwhile "git fetch" does support submodule.recurse, producing
	confusing behavior: when submodule.recurse is enabled, "git pull"
	recursively fetches submodules but does not update them after fetch.
	Handle submodule.recurse in "git pull" to fix this.
> ---
>  builtin/pull.c | 5 +++++
>  1 file changed, 5 insertions(+)

Can you add a test to avoid future changes causing this to regress? See t/t5572-pull-submodule.sh for some existing tests to get inspiration from.

Show 16 quoted lines
> 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;
> +	}
>  	return git_default_config(var, value, cb);
>  }
>  
The rest looks good.

Thanks for working on this, Jonathan

Previous: René Scharfe
Message 5 of 5 in “submodule: --recurse-submodules vs. submodule.recurse=true”
  1. Magnus HomannSep 1, 2017
  2. pull: honor submodule.recurse config optionNicolas Morey-Chaisemartin, Sep 1, 2017
  3. Stefan BellerSep 1, 2017
  4. René ScharfeSep 1, 2017
  5. Jonathan NiederSep 1, 2017

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.