Files
git/builtin
Adrian Ratiu 03b4043b91 hook: include hooks from the config
Teach the hook.[hc] library to parse configs to populate the list of
hooks to run for a given event.

Multiple commands can be specified for a given hook by providing
"hook.<friendly-name>.command = <path-to-hook>" and
"hook.<friendly-name>.event = <hook-event>" lines.

Hooks will be started in config order of the "hook.<name>.event"
lines and will be run sequentially (.jobs == 1) like before.
Running the hooks in parallel will be enabled in a future patch.

The "traditional" hook from the hookdir is run last, if present.

A strmap cache is added to struct repository to avoid re-reading
the configs on each rook run. This is useful for hooks like the
ref-transaction which gets executed multiple times per process.

Examples:

  $ git config --get-regexp "^hook\."
  hook.bar.command=~/bar.sh
  hook.bar.event=pre-commit

  # Will run ~/bar.sh, then .git/hooks/pre-commit
  $ git hook run pre-commit

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-19 13:23:41 -08:00
..
2025-10-02 12:26:11 -07:00
2025-11-19 10:55:39 -08:00
2025-12-05 14:49:56 +09:00
2024-12-13 07:33:36 -08:00
2025-07-23 08:15:18 -07:00
2025-09-29 11:40:35 -07:00
2025-07-23 08:15:18 -07:00
2025-07-23 08:15:18 -07:00
2025-07-23 08:15:18 -07:00
2025-07-01 14:46:38 -07:00
2025-08-22 13:13:20 -07:00
2026-02-19 13:23:41 -08:00
2025-12-25 08:29:27 +09:00
2024-12-18 10:44:31 -08:00
2025-07-16 22:16:15 -07:00
2025-07-23 08:15:18 -07:00
2025-12-25 08:29:27 +09:00
2025-08-21 13:47:00 -07:00
2025-10-02 12:26:12 -07:00
2026-01-06 07:30:16 +09:00
2025-07-23 08:15:18 -07:00
2025-11-19 10:55:39 -08:00
2025-07-23 08:15:18 -07:00
2025-07-23 08:15:18 -07:00
2025-09-16 11:37:06 -07:00
2025-08-21 13:46:59 -07:00