Skip to content

Commit 2e5dbaf

Browse files
10ne1gitster
authored andcommitted
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>
1 parent a8b1ba8 commit 2e5dbaf

4 files changed

Lines changed: 20 additions & 20 deletions

File tree

Documentation/config/hook.adoc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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].
88

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
1212
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
1515
events, specify the key more than once. An empty value resets
1616
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].
1818

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`.
2121
Set to `false` to disable the hook without removing its
2222
configuration. This is particularly useful when a hook is defined
2323
in a system or global config file and needs to be disabled for a

Documentation/git-hook.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ event`), and then `~/bin/spellchecker` will have a chance to check your commit
4444
message (during the `commit-msg` hook event).
4545

4646
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
4848
linkgit:git-config[1]). Although multiple `hook.linter.event` configs can be
4949
added, only one `hook.linter.command` event is valid - Git uses "last-one-wins"
5050
to determine which command to run.
@@ -76,10 +76,10 @@ first start `~/bin/linter --cpp20` and second start `~/bin/leak-detector`. It
7676
would evaluate the output of each when deciding whether to proceed with the
7777
commit.
7878

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,
8080
and how hooks are invoked during those events, see linkgit:githooks[5].
8181

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
8383
recognize. This is intended so that tools which wrap Git can use the hook
8484
infrastructure to run their own hooks; see "WRAPPERS" for more guidance.
8585

hook.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static void list_hooks_add_default(struct repository *r, const char *hookname,
112112
* Callback struct to collect all hook.* keys in a single config pass.
113113
* commands: friendly-name to command map.
114114
* 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.
116116
*/
117117
struct hook_all_config_cb {
118118
struct strmap commands;

hook.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ typedef void *(*hook_data_alloc_fn)(void *init_ctx);
1414
* Represents a hook command to be run.
1515
* Hooks can be:
1616
* 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).
1818
* The 'kind' field determines which part of the union 'u' is valid.
1919
*/
2020
struct hook {

0 commit comments

Comments
 (0)