blob: 05a8700cb3f573b9acbda2dc102e7d04549017c7 (
plain)
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
|
package hooks
import (
"os"
"path"
"gitlab.com/gitlab-org/gitaly/internal/config"
)
// Override allows tests to control where the hooks directory is.
var Override string
// Path returns the path where the global git hooks are located. If the
// environment variable GITALY_TESTING_NO_GIT_HOOKS is set to "1", Path
// will return an empty directory, which has the effect that no Git hooks
// will run at all.
func Path() string {
if len(Override) > 0 {
return Override
}
if os.Getenv("GITALY_TESTING_NO_GIT_HOOKS") == "1" {
return "/var/empty"
}
return path.Join(config.Config.Ruby.Dir, "git-hooks")
}
func GitPath() string {
if len(Override) > 0 {
return Override
}
if os.Getenv("GITALY_TESTING_NO_GIT_HOOKS") == "1" {
return "/var/empty"
}
return path.Join(config.Config.BinDir, "hooks")
}
|