From 8bfc155aee0f7a374375e38927d7074047829422 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 1 Sep 2015 17:44:30 +0800 Subject: [PATCH] Fix hook check logic Signed-off-by: Chengwei Yang --- pkg/server/hooks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/server/hooks.go b/pkg/server/hooks.go index 5a5561add..134621226 100644 --- a/pkg/server/hooks.go +++ b/pkg/server/hooks.go @@ -67,11 +67,11 @@ func PostHook(c *gin.Context) { log.Warnf("ignoring hook. repo %s has no owner.", repo.FullName) c.Writer.WriteHeader(204) return - case !repo.Hooks.Push && hook.PullRequest != nil: + case !repo.Hooks.Push && hook.Commit != nil: log.Infof("ignoring hook. repo %s is disabled.", repo.FullName) c.Writer.WriteHeader(204) return - case !repo.Hooks.PullRequest && hook.PullRequest == nil: + case !repo.Hooks.PullRequest && hook.PullRequest != nil: log.Warnf("ignoring hook. repo %s is disabled for pull requests.", repo.FullName) c.Writer.WriteHeader(204) return