Subject: Re: [PATCH v3 6/9] hook: add -j/--jobs option to git hook run

From: Junio C Hamano <[email-masked]>
Date: Sun, 15 Mar 2026 14:00:03 -0700

Adrian Ratiu <[email-masked]> writes:

> diff --git a/hook.c b/hook.c
> index 815b299bf8..299cbf9e97 100644
> --- a/hook.c
> +++ b/hook.c
> @@ -567,15 +567,17 @@ static unsigned int get_hook_jobs(struct repository *r,
>  	if (!options->stdout_to_stderr)
>  		return 1;
>  
> -	/* An explicit job count (FORCE_SERIAL jobs=1, or -j from CLI). */
> -	if (options->jobs)
> -		return options->jobs;
> +	/* Pinned serial: FORCE_SERIAL (internal) or explicit -j1 from CLI. */
> +	if (options->jobs == 1)
> +		return 1;

Hmph, puzzled.  

Shouldn't just -j1 but -j12 from CLI also trump configured
parallelism?  Which was what the code before this step already did,
no?

>  	/*
> +	 * Resolve effective job count: -jN (when given) overrides config.
> +	 * Default to 1 when both config an -jN are missing.
>  	 */
> -	if (r && r->gitdir && r->hook_config_cache)
> +	if (options->jobs > 1)
> +		jobs = options->jobs;
> +	else if (r && r->gitdir && r->hook_config_cache)
>  		/* Use the already-parsed cache (in-repo) */
>  		jobs = r->hook_config_cache->jobs ? r->hook_config_cache->jobs : 1;
>  	else