Re: [PATCH v3 6/9] hook: add -j/--jobs option to git hook run
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 15, 2026, 21:00 UTC
- Message-ID
- <xmqq7brcst9o.fsf@gitster.g>
- In-Reply-To
- <20260309133739.294555-7-adrian.ratiu@collabora.com>
Adrian Ratiu <adrian.ratiu@collabora.com> writes:
Show 14 quoted lines
> 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?
Show 11 quoted lines
> /* > + * 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