diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-02-25 17:12:19 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-02-25 17:12:19 +0300 |
commit | 5d86332153838252384f9f87a0ae3e34c46eb266 (patch) | |
tree | 47de3c1f04c5b2302f6269d6284d68cd29158214 /app/workers | |
parent | 769f137a5344dbc3748c2fea7c1d560392410ca4 (diff) |
Send EmailsOnPush when deleting commits using force push.
See #1924.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/emails_on_push_worker.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb index 309772cb5ce..2e783814824 100644 --- a/app/workers/emails_on_push_worker.rb +++ b/app/workers/emails_on_push_worker.rb @@ -15,8 +15,15 @@ class EmailsOnPushWorker compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha) - # Do not send emails if git compare failed - return false unless compare && compare.commits.present? + return false if compare.same + + if compare.commits.empty? + compare = Gitlab::Git::Compare.new(project.repository.raw_repository, after_sha, before_sha) + + reverse_compare = true + + return false if compare.commits.empty? + end recipients.split(" ").each do |recipient| Notify.repository_push_email( @@ -25,6 +32,7 @@ class EmailsOnPushWorker author_id, branch, compare, + reverse_compare, send_from_committer_email, disable_diffs ).deliver |