]> git.ipfire.org Git - thirdparty/git.git/commit
hook: allow parallel hook execution
authorEmily Shaffer <nasamuffin@google.com>
Fri, 10 Apr 2026 09:05:59 +0000 (12:05 +0300)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Apr 2026 14:58:53 +0000 (07:58 -0700)
commit680e69f60d2b3838bb98938dbd3e8881bdfde7d6
treea98f4109ab21f7ff283f73eca76cf063d1362291
parentb9a4c9ad247a09602e0e6d0eccec6a43857f62da
hook: allow parallel hook execution

Hooks always run in sequential order due to the hardcoded jobs == 1
passed to run_process_parallel(). Remove that hardcoding to allow
users to run hooks in parallel (opt-in).

Users need to decide which hooks to run in parallel, by specifying
"parallel = true" in the config, because Git cannot know if their
specific hooks are safe to run or not in parallel (for e.g. two hooks
might write to the same file or call the same program).

Some hooks are unsafe to run in parallel by design: these will marked
in the next commit using RUN_HOOKS_OPT_INIT_FORCE_SERIAL.

The hook.jobs config specifies the default number of jobs applied to all
hooks which have parallelism enabled.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/hook.adoc
hook.c
hook.h
t/t1800-hook.sh