doc: hook: don’t self-link via config include

Do not link to git-hook(1) from the config options when we already are in that doc. This implementation is similar to the updates to git-init(1) and git-commit(1), implemented in [1] and [2], respectively. † 1: e7b3a768 (doc: git-init: rework config item init.templateDir, 2024-03-10) † 2: 819fdd6e (doc: convert git commit config to new format, 2025-01-15) Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kristoffer Haugsbakk committed May 21, 2026 at 18:25 UTC 5c6a41e4b5b60ea397393fb0542c7d67553a105e
2 files changed +14 -6
Documentation/config/hook.adoc
+13 -6
@@ -1,10 +1,17 @@
1 +ifdef::git-hook[]
2 +:see-git-hook:
3 +endif::git-hook[]
4 +ifndef::git-hook[]
5 +:see-git-hook: See linkgit:git-hook[1].
6 +endif::git-hook[]
7 +
8 hook.<friendly-name>.command::
9 The command to execute for `hook.<friendly-name>`. `<friendly-name>`
10 is a unique name that identifies this hook. The hook events that
11 trigger the command are configured with `hook.<friendly-name>.event`.
12 The value can be an executable path or a shell oneliner. If more than
13 one value is specified for the same `<friendly-name>`, only the last
7 - value parsed is used. See linkgit:git-hook[1].
14 + value parsed is used. {see-git-hook}
15
16 hook.<friendly-name>.event::
17 The hook events that trigger `hook.<friendly-name>`. The value is the
@@ -14,7 +21,7 @@ hook.<friendly-name>.event::
21 This is a multi-valued key. To run `hook.<friendly-name>` on multiple
22 events, specify the key more than once. An empty value resets
23 the list of events, clearing any previously defined events for
17 - `hook.<friendly-name>`. See linkgit:git-hook[1].
24 + `hook.<friendly-name>`. {see-git-hook}
25 +
26 The `<friendly-name>` must not be the same as a known hook event name
27 (e.g. do not use `hook.pre-commit.event`). Using a known event name as
@@ -27,7 +34,7 @@ hook.<friendly-name>.enabled::
34 Set to `false` to disable the hook without removing its
35 configuration. This is particularly useful when a hook is defined
36 in a system or global config file and needs to be disabled for a
30 - specific repository. See linkgit:git-hook[1].
37 + specific repository. {see-git-hook}
38
39 hook.<friendly-name>.parallel::
40 Whether the hook `hook.<friendly-name>` may run in parallel with other hooks
@@ -37,13 +44,13 @@ hook.<friendly-name>.parallel::
44 all hooks for that event run sequentially regardless of `hook.jobs`.
45 Only configured (named) hooks need to declare this. Traditional hooks
46 found in the hooks directory do not need to, and run in parallel when
40 - the effective job count is greater than 1. See linkgit:git-hook[1].
47 + the effective job count is greater than 1. {see-git-hook}
48
49 hook.<event>.enabled::
50 Switch to enable or disable all hooks for the `<event>` hook event.
51 When set to `false`, no hooks fire for that event, regardless of any
52 per-hook `hook.<friendly-name>.enabled` settings. Defaults to `true`.
46 - See linkgit:git-hook[1].
53 + {see-git-hook}
54 +
55 Note on naming: `<event>` must be the event name (e.g. `pre-commit`),
56 not a hook friendly-name. Since using a known event name as a
@@ -60,7 +67,7 @@ hook.<event>.jobs::
67 setting has no effect unless all configured hooks for the event have
68 `hook.<friendly-name>.parallel` set to `true`. Set to `-1` to use the
69 number of available CPU cores. Must be a positive integer or `-1`;
63 - zero is rejected with a warning. See linkgit:git-hook[1].
70 + zero is rejected with a warning. {see-git-hook}
71 +
72 Note on naming: although this key resembles `hook.<friendly-name>.*`
73 (a per-hook setting), `<event>` must be the event name, not a hook
Documentation/git-hook.adoc
+1
@@ -204,6 +204,7 @@ unintended and unsupported ways.
204
205 CONFIGURATION
206 -------------
207 +:git-hook: 1
208 include::config/hook.adoc[]
209
210 SEE ALSO