hook: make consistent use of friendly-name in docs
Both `name` and `friendly-name` is being used. Standardize on `friendly-name` for consistency since name is rather generic, even when used in the hooks namespace. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Adrian Ratiu committed
Mar 25, 2026 at 21:54 UTC
2e5dbaff169dfb28fa8e8c4f992d8252a4ef1312
4 files changed
+20
-20
Documentation/config/hook.adoc
+15
-15
@@ -1,23 +1,23 @@
1
-hook.<name>.command::
2
- The command to execute for `hook.<name>`. `<name>` is a unique
3
- "friendly" name that identifies this hook. (The hook events that
4
- trigger the command are configured with `hook.<name>.event`.) The
5
- value can be an executable path or a shell oneliner. If more than
6
- one value is specified for the same `<name>`, only the last value
7
- parsed is used. See linkgit:git-hook[1].
1
+hook.<friendly-name>.command::
2
+ The command to execute for `hook.<friendly-name>`. `<friendly-name>`
3
+ is a unique name that identifies this hook. The hook events that
4
+ trigger the command are configured with `hook.<friendly-name>.event`.
5
+ The value can be an executable path or a shell oneliner. If more than
6
+ one value is specified for the same `<friendly-name>`, only the last
7
+ value parsed is used. See linkgit:git-hook[1].
8
9
-hook.<name>.event::
10
- The hook events that trigger `hook.<name>`. The value is the name
11
- of a hook event, like "pre-commit" or "update". (See
9
+hook.<friendly-name>.event::
10
+ The hook events that trigger `hook.<friendly-name>`. The value is the
11
+ name of a hook event, like "pre-commit" or "update". (See
12
linkgit:githooks[5] for a complete list of hook events.) On the
13
- specified event, the associated `hook.<name>.command` is executed.
14
- This is a multi-valued key. To run `hook.<name>` on multiple
13
+ specified event, the associated `hook.<friendly-name>.command` is executed.
14
+ This is a multi-valued key. To run `hook.<friendly-name>` on multiple
15
events, specify the key more than once. An empty value resets
16
the list of events, clearing any previously defined events for
17
- `hook.<name>`. See linkgit:git-hook[1].
17
+ `hook.<friendly-name>`. See linkgit:git-hook[1].
18
19
-hook.<name>.enabled::
20
- Whether the hook `hook.<name>` is enabled. Defaults to `true`.
19
+hook.<friendly-name>.enabled::
20
+ Whether the hook `hook.<friendly-name>` is enabled. Defaults to `true`.
21
Set to `false` to disable the hook without removing its
22
configuration. This is particularly useful when a hook is defined
23
in a system or global config file and needs to be disabled for a
Documentation/git-hook.adoc
+3
-3
@@ -44,7 +44,7 @@ event`), and then `~/bin/spellchecker` will have a chance to check your commit
44
message (during the `commit-msg` hook event).
45
46
Commands are run in the order Git encounters their associated
47
-`hook.<name>.event` configs during the configuration parse (see
47
+`hook.<friendly-name>.event` configs during the configuration parse (see
48
linkgit:git-config[1]). Although multiple `hook.linter.event` configs can be
49
added, only one `hook.linter.command` event is valid - Git uses "last-one-wins"
50
to determine which command to run.
@@ -76,10 +76,10 @@ first start `~/bin/linter --cpp20` and second start `~/bin/leak-detector`. It
76
would evaluate the output of each when deciding whether to proceed with the
77
commit.
78
79
-For a full list of hook events which you can set your `hook.<name>.event` to,
79
+For a full list of hook events which you can set your `hook.<friendly-name>.event` to,
80
and how hooks are invoked during those events, see linkgit:githooks[5].
81
82
-Git will ignore any `hook.<name>.event` that specifies an event it doesn't
82
+Git will ignore any `hook.<friendly-name>.event` that specifies an event it doesn't
83
recognize. This is intended so that tools which wrap Git can use the hook
84
infrastructure to run their own hooks; see "WRAPPERS" for more guidance.
85
hook.c
+1
-1
@@ -112,7 +112,7 @@ static void list_hooks_add_default(struct repository *r, const char *hookname,
112
* Callback struct to collect all hook.* keys in a single config pass.
113
* commands: friendly-name to command map.
114
* event_hooks: event-name to list of friendly-names map.
115
- * disabled_hooks: set of friendly-names with hook.name.enabled = false.
115
+ * disabled_hooks: set of friendly-names with hook.<friendly-name>.enabled = false.
116
*/
117
struct hook_all_config_cb {
118
struct strmap commands;
hook.h
+1
-1
@@ -14,7 +14,7 @@ typedef void *(*hook_data_alloc_fn)(void *init_ctx);
14
* Represents a hook command to be run.
15
* Hooks can be:
16
* 1. "traditional" (found in the hooks directory)
17
- * 2. "configured" (defined in Git's configuration via hook.<name>.event).
17
+ * 2. "configured" (defined in Git's configuration via hook.<friendly-name>.event).
18
* The 'kind' field determines which part of the union 'u' is valid.
19
*/
20
struct hook {