From 8d212f778cf92e97c0e12b514d980982294e5675 Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 13 May 2020 08:50:56 +0100 Subject: [PATCH] Revert "Avoid 0 new commits messages to be send (#11082)" (#11397) This reverts commit 6034f8bcaaa5348fee775d2307ff03162130a088. --- modules/repofiles/action.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/repofiles/action.go b/modules/repofiles/action.go index 19765a7477..44ca285ef0 100644 --- a/modules/repofiles/action.go +++ b/modules/repofiles/action.go @@ -249,12 +249,12 @@ func CommitRepoAction(optsList ...*CommitRepoActionOptions) error { IsPrivate: repo.IsPrivate, } + var isHookEventPush = true switch opType { case models.ActionCommitRepo: // Push if opts.IsNewBranch() { notification.NotifyCreateRef(pusher, repo, "branch", opts.RefFullName) } - notification.NotifyPushCommits(pusher, repo, opts.RefFullName, opts.OldCommitID, opts.NewCommitID, opts.Commits) case models.ActionDeleteBranch: // Delete Branch notification.NotifyDeleteRef(pusher, repo, "branch", opts.RefFullName) @@ -263,6 +263,12 @@ func CommitRepoAction(optsList ...*CommitRepoActionOptions) error { case models.ActionDeleteTag: // Delete Tag notification.NotifyDeleteRef(pusher, repo, "tag", opts.RefFullName) + default: + isHookEventPush = false + } + + if isHookEventPush { + notification.NotifyPushCommits(pusher, repo, opts.RefFullName, opts.OldCommitID, opts.NewCommitID, opts.Commits) } }