diff options
Diffstat (limited to 'cmd/hook.go')
-rw-r--r-- | cmd/hook.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/hook.go b/cmd/hook.go index 0ff4a1c6..f8b96970 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -11,6 +11,7 @@ import ( "fmt" "os" "os/exec" + "path" "path/filepath" "strings" @@ -22,7 +23,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/pkg/httplib" + "github.com/gogits/gogs/pkg/mailer" "github.com/gogits/gogs/pkg/setting" + "github.com/gogits/gogs/pkg/template" http "github.com/gogits/gogs/routes/repo" ) @@ -184,6 +187,13 @@ func runHookPostReceive(c *cli.Context) error { } setup(c, "hooks/post-receive.log", true) + // Post-receive hook does more than just gather Git information, + // so we need to setup additional services for email notifications. + setting.NewPostReceiveHookServices() + mailer.NewContext() + mailer.InitMailRender(path.Join(setting.StaticRootPath, "templates/mail"), + path.Join(setting.CustomPath, "templates/mail"), template.NewFuncMap()) + isWiki := strings.Contains(os.Getenv(http.ENV_REPO_CUSTOM_HOOKS_PATH), ".wiki.git/") buf := bytes.NewBuffer(nil) |