Re: [PATCH v2] submodule-config: fix reading submodule.fetchJobs
- From
Pablo <pabloosabaterr@gmail.com>
- Date
- May 3, 2026, 13:07 UTC
- Message-ID
- <CAN5EUNTPiu7p=M8CZB_3Rcbsn34eEZC6YeiA3NW2zM7zSS42HQ@mail.gmail.com>
- In-Reply-To
- <pull.2287.v2.git.git.1777809430925.gitgitgadget@gmail.com>
El dom, 3 may 2026 a las 13:57, Saagar Jha via GitGitGadget (<gitgitgadget@gmail.com>) escribió:
Show 6 quoted lines
> > From: Saagar Jha <saagar@saagarjha.com> > > The old code accidentally passed &max_jobs rather than max_jobs into > config_from_gitmodules, which caused the setting to be written to the > wrong place and dropped.
Better, but we can improve this, following Documentation/SubmittingPatches [1], it is better to write in present tense something like:
update_clone_config_from_gitmodules() passes &max_jobs to config_from_gitmodules(), but max_jobs is already a pointer. This causes the config value to be written to the wrong address and dropped.
Pass max_jobs directly.
I recommend reading Documentation/SubmittingPatches: [1]: https://github.com/git/git/blob/master/Documentation/SubmittingPatches
Show 65 quoted lines
>
> Signed-off-by: Saagar Jha <saagar@saagarjha.com>
> ---
> submodule-config: fix reading submodule.fetchJobs
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2287%2Fsaagarjha%2Fmaint-v2
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2287/saagarjha/maint-v2
> Pull-Request: https://github.com/git/git/pull/2287
>
> Range-diff vs v1:
>
> 1: 094c641227 ! 1: 868901f1a6 submodule-config: fix reading submodule.fetchJobs
> @@ Metadata
> ## Commit message ##
> submodule-config: fix reading submodule.fetchJobs
>
> + The old code accidentally passed &max_jobs rather than max_jobs into
> + config_from_gitmodules, which caused the setting to be written to the
> + wrong place and dropped.
> +
> Signed-off-by: Saagar Jha <saagar@saagarjha.com>
>
> ## submodule-config.c ##
>
>
> submodule-config.c | 2 +-
> t/t7406-submodule-update.sh | 10 ++++++++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/submodule-config.c b/submodule-config.c
> index 1f19fe2077..57b190678e 100644
> --- a/submodule-config.c
> +++ b/submodule-config.c
> @@ -1037,5 +1037,5 @@ static int gitmodules_update_clone_config(const char *var, const char *value,
>
> void update_clone_config_from_gitmodules(int *max_jobs)
> {
> - config_from_gitmodules(gitmodules_update_clone_config, the_repository, &max_jobs);
> + config_from_gitmodules(gitmodules_update_clone_config, the_repository, max_jobs);
> }
> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> index 3adab12091..234a021fb3 100755
> --- a/t/t7406-submodule-update.sh
> +++ b/t/t7406-submodule-update.sh
> @@ -1055,6 +1055,16 @@ test_expect_success 'submodule update can be run in parallel' '
> )
> '
>
> +test_expect_success 'submodule update honors fetch jobs config from .gitmodules' '
> + test_when_finished "rm -rf super3" &&
> + git clone cloned super3 &&
> + (cd super3 &&
> + git config -f .gitmodules submodule.fetchJobs 67 &&
> + GIT_TRACE="$(pwd)/trace.out" git submodule update --init &&
> + grep "67 tasks" trace.out
> + )
> +'
> +
> test_expect_success 'git clone passes the parallel jobs config on to submodules' '
> test_when_finished "rm -rf super4" &&
> GIT_TRACE=$(pwd)/trace.out git clone --recurse-submodules --jobs 7 . super4 &&
>
> base-commit: 67ad42147a7acc2af6074753ebd03d904476118f
> --
> gitgitgadget