]> git.ipfire.org Git - thirdparty/git.git/commitdiff
hook: make consistent use of friendly-name in docs
authorAdrian Ratiu <adrian.ratiu@collabora.com>
Wed, 25 Mar 2026 19:54:58 +0000 (21:54 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Mar 2026 21:00:46 +0000 (14:00 -0700)
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>
Documentation/config/hook.adoc
Documentation/git-hook.adoc
hook.c
hook.h

index 64e845a260380d29a6b85275f64bda631e0e6fd6..9e78f264396ca5150faa617a2083b3e5807143ed 100644 (file)
@@ -1,23 +1,23 @@
-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.<friendly-name>.command::
+       The command to execute for `hook.<friendly-name>`. `<friendly-name>`
+       is a unique name that identifies this hook. The hook events that
+       trigger the command are configured with `hook.<friendly-name>.event`.
+       The value can be an executable path or a shell oneliner. If more than
+       one value is specified for the same `<friendly-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
+hook.<friendly-name>.event::
+       The hook events that trigger `hook.<friendly-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
+       specified event, the associated `hook.<friendly-name>.command` is executed.
+       This is a multi-valued key. To run `hook.<friendly-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.<friendly-name>`. See linkgit:git-hook[1].
 
-hook.<name>.enabled::
-       Whether the hook `hook.<name>` is enabled. Defaults to `true`.
+hook.<friendly-name>.enabled::
+       Whether the hook `hook.<friendly-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
index 12d2701b5228acd0029f9bbe5ff2975a7b569f37..966388660aea4070e8dfc475f67cbaafa88d4d8f 100644 (file)
@@ -44,7 +44,7 @@ event`), and then `~/bin/spellchecker` will have a chance to check your commit
 message (during the `commit-msg` hook event).
 
 Commands are run in the order Git encounters their associated
-`hook.<name>.event` configs during the configuration parse (see
+`hook.<friendly-name>.event` configs during the configuration parse (see
 linkgit:git-config[1]). Although multiple `hook.linter.event` configs can be
 added, only one `hook.linter.command` event is valid - Git uses "last-one-wins"
 to determine which command to run.
@@ -76,10 +76,10 @@ first start `~/bin/linter --cpp20` and second start `~/bin/leak-detector`. It
 would evaluate the output of each when deciding whether to proceed with the
 commit.
 
-For a full list of hook events which you can set your `hook.<name>.event` to,
+For a full list of hook events which you can set your `hook.<friendly-name>.event` to,
 and how hooks are invoked during those events, see linkgit:githooks[5].
 
-Git will ignore any `hook.<name>.event` that specifies an event it doesn't
+Git will ignore any `hook.<friendly-name>.event` that specifies an event it doesn't
 recognize. This is intended so that tools which wrap Git can use the hook
 infrastructure to run their own hooks; see "WRAPPERS" for more guidance.
 
diff --git a/hook.c b/hook.c
index 021110f21646a6b1cb383595bf49ff96208790b1..dc0c3de667b871c844dab491df2a5ac28558ea7f 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -112,7 +112,7 @@ static void list_hooks_add_default(struct repository *r, const char *hookname,
  * Callback struct to collect all hook.* keys in a single config pass.
  * commands: friendly-name to command map.
  * event_hooks: event-name to list of friendly-names map.
- * disabled_hooks: set of friendly-names with hook.name.enabled = false.
+ * disabled_hooks: set of friendly-names with hook.<friendly-name>.enabled = false.
  */
 struct hook_all_config_cb {
        struct strmap commands;
diff --git a/hook.h b/hook.h
index a56ac20ccfbb6f368d284efd3bfadf15bb259b6b..d2cf59e64941fd4b80f795648f98fd3f8fcd0a6e 100644 (file)
--- a/hook.h
+++ b/hook.h
@@ -14,7 +14,7 @@ typedef void *(*hook_data_alloc_fn)(void *init_ctx);
  * Represents a hook command to be run.
  * Hooks can be:
  * 1. "traditional" (found in the hooks directory)
- * 2. "configured" (defined in Git's configuration via hook.<name>.event).
+ * 2. "configured" (defined in Git's configuration via hook.<friendly-name>.event).
  * The 'kind' field determines which part of the union 'u' is valid.
  */
 struct hook {