forked from evilmartians/lefthook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavailable_hooks.go
58 lines (51 loc) · 1.2 KB
/
available_hooks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package config
// ChecksumFileName - the file, which is used just to store the current config checksum version.
const ChecksumFileName = "lefthook.checksum"
// GhostHookName - the hook which logs are not shown and which is used for synchronizing hooks.
const GhostHookName = "prepare-commit-msg"
// AvailableHooks - list of hooks taken from https://git-scm.com/docs/githooks.
var AvailableHooks = [...]string{
"pre-commit",
"pre-push",
"commit-msg",
"applypatch-msg",
"fsmonitor-watchman",
"p4-changelist",
"p4-post-changelist",
"p4-pre-submit",
"p4-prepare-changelist",
"post-applypatch",
"post-checkout",
"post-commit",
"post-index-change",
"post-merge",
"post-receive",
"post-rewrite",
"post-update",
"pre-applypatch",
"pre-auto-gc",
"pre-merge-commit",
"pre-rebase",
"pre-receive",
"prepare-commit-msg",
"proc-receive",
"push-to-checkout",
"rebase",
"reference-transaction",
"sendemail-validate",
"update",
}
func HookUsesStagedFiles(hook string) bool {
return hook == "pre-commit"
}
func HookUsesPushFiles(hook string) bool {
return hook == "pre-push"
}
func HookAvailable(hook string) bool {
for _, name := range AvailableHooks {
if name == hook {
return true
}
}
return false
}