Skip to content

Commit

Permalink
Avoid 0 new commits messages to be send (go-gitea#11082)
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelk authored Apr 18, 2020
1 parent 4f597b1 commit 6034f8b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions modules/repofiles/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
}
}

Expand Down

0 comments on commit 6034f8b

Please sign in to comment.