-
Notifications
You must be signed in to change notification settings - Fork 220
/
Copy pathavailable_hooks.go
53 lines (47 loc) · 1.52 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
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.
// Keep the order of the hooks same here for easy syncing.
var AvailableHooks = map[string]struct{}{
"applypatch-msg": {},
"pre-applypatch": {},
"post-applypatch": {},
"pre-commit": {},
"pre-merge-commit": {},
"prepare-commit-msg": {},
"commit-msg": {},
"post-commit": {},
"pre-rebase": {},
"post-checkout": {},
"post-merge": {},
"pre-push": {},
"pre-receive": {},
"update": {},
"proc-receive": {},
"post-receive": {},
"post-update": {},
"reference-transaction": {},
"push-to-checkout": {},
"pre-auto-gc": {},
"post-rewrite": {},
"sendemail-validate": {},
"fsmonitor-watchman": {},
"p4-changelist": {},
"p4-prepare-changelist": {},
"p4-post-changelist": {},
"p4-pre-submit": {},
"post-index-change": {},
}
func HookUsesStagedFiles(hook string) bool {
return hook == "pre-commit"
}
func HookUsesPushFiles(hook string) bool {
return hook == "pre-push"
}
func KnownHook(hook string) bool {
_, ok := AvailableHooks[hook]
return ok
}