diff options
Diffstat (limited to 'vendor/github.com/gogits/git-module/hook.go')
-rw-r--r-- | vendor/github.com/gogits/git-module/hook.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/vendor/github.com/gogits/git-module/hook.go b/vendor/github.com/gogits/git-module/hook.go index 6ba66be0..a0d0b16b 100644 --- a/vendor/github.com/gogits/git-module/hook.go +++ b/vendor/github.com/gogits/git-module/hook.go @@ -13,8 +13,9 @@ import ( ) var ( - // Direcotry of hook file. Can be changed to "custom_hooks" for very purpose. - HookDir = "hooks" + // Direcotry of hook and sample files. Can be changed to "custom_hooks" for very purpose. + HookDir = "hooks" + HookSampleDir = HookDir // HookNames is a list of Git server hooks' name that are supported. HookNames = []string{ "pre-receive", @@ -62,8 +63,13 @@ func GetHook(repoPath, name string) (*Hook, error) { } h.IsActive = true h.Content = string(data) - } else if isFile(h.path + ".sample") { - data, err := ioutil.ReadFile(h.path + ".sample") + return h, nil + } + + // Check sample file + samplePath := path.Join(repoPath, HookSampleDir, h.name) + ".sample" + if isFile(samplePath) { + data, err := ioutil.ReadFile(samplePath) if err != nil { return nil, err } |