diff options
author | Dennis Tang <dtang@gitlab.com> | 2018-06-21 11:48:25 +0300 |
---|---|---|
committer | Dennis Tang <dtang@gitlab.com> | 2018-06-21 11:48:25 +0300 |
commit | 0e7f8fd5bd7ed184b8a12039739200065ffa2dbd (patch) | |
tree | 07b3c3bbcc0d05848ab7034d2ed32a801f8786b9 /app/models/merge_request.rb | |
parent | 203d1026008effeeba5c1f98dba768448473f9fe (diff) | |
parent | 904cbe0132a1caf0dbb7efb8bdc70398d1d82289 (diff) |
Merge remote-tracking branch 'origin/master' into 43446-new-cluster-page-tabs
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 324065c1162..4b78ba1029f 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -128,8 +128,17 @@ class MergeRequest < ActiveRecord::Base end after_transition unchecked: :cannot_be_merged do |merge_request, transition| - NotificationService.new.merge_request_unmergeable(merge_request) - TodoService.new.merge_request_became_unmergeable(merge_request) + begin + # Merge request can become unmergeable due to many reasons. + # We only notify if it is due to conflict. + unless merge_request.project.repository.can_be_merged?(merge_request.diff_head_sha, merge_request.target_branch) + NotificationService.new.merge_request_unmergeable(merge_request) + TodoService.new.merge_request_became_unmergeable(merge_request) + end + rescue Gitlab::Git::CommandError + # Checking mergeability can trigger exception, e.g. non-utf8 + # We ignore this type of errors. + end end def check_state?(merge_status) |