mirror of
https://github.com/git/git.git
synced 2026-03-05 06:57:37 +01:00
Add a new config `hook.forceStdoutToStderr` which allows enabling extensions.hookStdoutToStderr by default at runtime, both for new and existing repositories. This makes it easier for users to enable hook parallelization for hooks like pre-push by enforcing output consistency. See previous commit for a more in-depth explanation & alternatives considered. Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
74 lines
3.7 KiB
Plaintext
74 lines
3.7 KiB
Plaintext
hook.<name>.command::
|
|
The command to execute for `hook.<name>`. `<name>` is a unique
|
|
"friendly" name that identifies this hook. (The hook events that
|
|
trigger the command are configured with `hook.<name>.event`.) The
|
|
value can be an executable path or a shell oneliner. If more than
|
|
one value is specified for the same `<name>`, only the last value
|
|
parsed is used. See linkgit:git-hook[1].
|
|
|
|
hook.<name>.event::
|
|
The hook events that trigger `hook.<name>`. The value is the name
|
|
of a hook event, like "pre-commit" or "update". (See
|
|
linkgit:githooks[5] for a complete list of hook events.) On the
|
|
specified event, the associated `hook.<name>.command` is executed.
|
|
This is a multi-valued key. To run `hook.<name>` on multiple
|
|
events, specify the key more than once. An empty value resets
|
|
the list of events, clearing any previously defined events for
|
|
`hook.<name>`. See linkgit:git-hook[1].
|
|
|
|
hook.<name>.enabled::
|
|
Whether the hook `hook.<name>` is enabled. Defaults to `true`.
|
|
Set to `false` to disable the hook without removing its
|
|
configuration. This is particularly useful when a hook is defined
|
|
in a system or global config file and needs to be disabled for a
|
|
specific repository. See linkgit:git-hook[1].
|
|
|
|
hook.<name>.parallel::
|
|
Whether the hook `hook.<name>` may run in parallel with other hooks
|
|
for the same event. Defaults to `false`. Set to `true` only when the
|
|
hook script is safe to run concurrently with other hooks for the same
|
|
event. If any hook for an event does not have this set to `true`,
|
|
all hooks for that event run sequentially regardless of `hook.jobs`.
|
|
Only configured (named) hooks need to declare this. Traditional hooks
|
|
found in the hooks directory do not need to, and run in parallel when
|
|
the effective job count is greater than 1. See linkgit:git-hook[1].
|
|
|
|
hook.<event>.jobs::
|
|
Specifies how many hooks can be run simultaneously for the `<event>`
|
|
hook event (e.g. `hook.post-receive.jobs = 4`). Overrides `hook.jobs`
|
|
for this specific event. The same parallelism restrictions apply: this
|
|
setting has no effect unless all configured hooks for the event have
|
|
`hook.<friendly-name>.parallel` set to `true`. Must be a positive int,
|
|
zero is rejected with a warning. See linkgit:git-hook[1].
|
|
+
|
|
Note on naming: although this key resembles `hook.<friendly-name>.*`
|
|
(a per-hook setting), `<event>` must be the event name, not a hook
|
|
friendly name. The key component is stored literally and looked up by
|
|
event name at runtime with no translation between the two namespaces.
|
|
A key like `hook.my-hook.jobs` is stored under `"my-hook"` but the
|
|
lookup at runtime uses the event name (e.g. `"post-receive"`), so
|
|
`hook.my-hook.jobs` is silently ignored even when `my-hook` is
|
|
registered for that event. Use `hook.post-receive.jobs` or any other
|
|
valid event name when setting `hook.<event>.jobs`.
|
|
|
|
hook.jobs::
|
|
Specifies how many hooks can be run simultaneously during parallelized
|
|
hook execution. If unspecified, defaults to 1 (serial execution).
|
|
Can be overridden on a per-event basis with `hook.<event>.jobs`.
|
|
Some hooks always run sequentially regardless of this setting because
|
|
git knows they cannot safely be parallelized: `applypatch-msg`,
|
|
`pre-commit`, `prepare-commit-msg`, `commit-msg`, `post-commit`,
|
|
`post-checkout`, and `push-to-checkout`.
|
|
+
|
|
This setting has no effect unless all configured hooks for the event have
|
|
`hook.<name>.parallel` set to `true`.
|
|
+
|
|
This has no effect for hooks requiring separate output streams (like `pre-push`)
|
|
unless `extensions.hookStdoutToStderr` is enabled.
|
|
|
|
hook.forceStdoutToStderr::
|
|
A boolean that enables the `extensions.hookStdoutToStderr` behavior
|
|
(merging stdout to stderr for all hooks) globally. This effectively
|
|
forces all hooks to behave as if the extension was enabled, allowing
|
|
parallel execution for hooks like `pre-push`.
|