From 6034f8bcaaa5348fee775d2307ff03162130a088 Mon Sep 17 00:00:00 2001 From: Cornel Date: Sat, 18 Apr 2020 23:02:59 +0300 Subject: [PATCH] Avoid 0 new commits messages to be send (#11082) Fixes #10498 --- modules/repofiles/action.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/repofiles/action.go b/modules/repofiles/action.go index 44ca285ef00..19765a74776 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,12 +263,6 @@ 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) } }