blob: 318b76361bfc67ee3540a200c7f5faf0da8db91b (
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
|
package hooks
import (
"path/filepath"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/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(cfg config.Cfg) string {
if len(Override) > 0 {
return Override
}
if config.SkipHooks() {
return "/var/empty"
}
return filepath.Join(cfg.Ruby.Dir, "git-hooks")
}
|