blob: 9357f0fe53b6c84e8a756bb8b9f78906114dad77 (
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
|
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. As a
// transitional mechanism, GITALY_USE_EMBEDDED_HOOKS=1 will cause
// Gitaly's embedded hooks to be used instead of the legacy gitlab-shell
// hooks.
func Path() string {
if len(Override) > 0 {
return Override
}
if os.Getenv("GITALY_USE_EMBEDDED_HOOKS") == "1" {
return path.Join(config.Config.Ruby.Dir, "git-hooks")
}
return path.Join(config.Config.GitlabShell.Dir, "hooks")
}
|