summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-06-19 21:22:38 +0800
committerMark Chao <mchao@gitlab.com>2018-06-20 23:38:13 +0800
commit937bd9e386f54eeac2ef2009173d58a7842f9779 (patch)
tree7918255e1ce1ee41bed19faf8b9869c55ea24f09
parent5b994b8199a3679b6f5ef0d00edce22ea9662664 (diff)
downloadgitlab-ce-47488-remove-unmergeable-notification-for-no-commits.tar.gz
Fix possiblilty of branch not found47488-remove-unmergeable-notification-for-no-commits
This now can happen because can_be_merged? is called during MR merge_status transition to cannot_be_merged. It is possible branch_name is invalid.
-rw-r--r--lib/gitlab/git/repository.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 77543206e13..b7965315eb2 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1413,8 +1413,11 @@ module Gitlab
end
def can_be_merged?(source_sha, target_branch)
- target_sha = find_branch(target_branch, true).target
- !gitaly_conflicts_client(source_sha, target_sha).conflicts?
+ if target_sha = find_branch(target_branch, true)&.target
+ !gitaly_conflicts_client(source_sha, target_sha).conflicts?
+ else
+ false
+ end
end
def search_files_by_name(query, ref)