Skip to content

Commit 25996c0

Browse files
committed
Merge branch 'es/config-hooks' into pu
The "hooks defined in config" topic. Ready??? * es/config-hooks: hook: add --porcelain to list command hook: add list command hook: scaffolding for git-hook subcommand doc: propose hooks managed by the config
2 parents e84603b + 09b4d75 commit 25996c0

File tree

11 files changed

+640
-0
lines changed

11 files changed

+640
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
/git-grep
7676
/git-hash-object
7777
/git-help
78+
/git-hook
7879
/git-http-backend
7980
/git-http-fetch
8081
/git-http-push

Documentation/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ SP_ARTICLES += $(API_DOCS)
8080
TECH_DOCS += MyFirstContribution
8181
TECH_DOCS += MyFirstObjectWalk
8282
TECH_DOCS += SubmittingPatches
83+
TECH_DOCS += technical/config-based-hooks
8384
TECH_DOCS += technical/hash-function-transition
8485
TECH_DOCS += technical/http-protocol
8586
TECH_DOCS += technical/index-format

Documentation/git-hook.txt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
git-hook(1)
2+
===========
3+
4+
NAME
5+
----
6+
git-hook - Manage configured hooks
7+
8+
SYNOPSIS
9+
--------
10+
[verse]
11+
'git hook' list [--porcelain] <hook-name>
12+
13+
DESCRIPTION
14+
-----------
15+
You can list, add, and modify hooks with this command.
16+
17+
This command parses the default configuration files for sections "hook" and
18+
"hookcmd". "hook" is used to describe the commands which will be run during a
19+
particular hook event; commands are run in config order. "hookcmd" is used to
20+
describe attributes of a specific command. If additional attributes don't need
21+
to be specified, a command to run can be specified directly in the "hook"
22+
section; if a "hookcmd" by that name isn't found, Git will attempt to run the
23+
provided value directly. For example:
24+
25+
Global config
26+
----
27+
[hook "post-commit"]
28+
command = "linter"
29+
command = "~/typocheck.sh"
30+
31+
[hookcmd "linter"]
32+
command = "/bin/linter --c"
33+
----
34+
35+
Local config
36+
----
37+
[hook "prepare-commit-msg"]
38+
command = "linter"
39+
[hook "post-commit"]
40+
command = "python ~/run-test-suite.py"
41+
----
42+
43+
COMMANDS
44+
--------
45+
46+
list [--porcelain] <hook-name>::
47+
48+
List the hooks which have been configured for <hook-name>. Hooks appear
49+
in the order they should be run, and note the config scope where the relevant
50+
`hook.<hook-name>.command` was specified, not the `hookcmd` (if applicable).
51+
+
52+
If `--porcelain` is specified, instead print the commands alone, separated by
53+
newlines, for easy parsing by a script.
54+
55+
OPTIONS
56+
-------
57+
--porcelain::
58+
With `list`, print the commands in the order they should be run,
59+
separated by newlines, for easy parsing by a script.
60+
61+
GIT
62+
---
63+
Part of the linkgit:git[1] suite

0 commit comments

Comments
 (0)