diff options
author | Mark Chao <mchao@gitlab.com> | 2018-06-21 00:55:34 +0800 |
---|---|---|
committer | Mark Chao <mchao@gitlab.com> | 2018-06-21 00:55:34 +0800 |
commit | 2c76701d4d4e1708cb60bb3aa2b97acd98a9b5c8 (patch) | |
tree | 6ab9c99ef572fff27b16a40e59409854084133ec | |
parent | 88671d9e796b82d474a8cf7bbf4f783bbfc0b3b7 (diff) | |
download | gitlab-ce-47488-remove-unmergeable-notification-for-no-commits-11-0-port.tar.gz |
Fix possiblilty of branch not found47488-remove-unmergeable-notification-for-no-commits-11-0-port
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.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 93f9adaf1f1..a0fad3833a9 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1494,7 +1494,11 @@ module Gitlab def can_be_merged?(source_sha, target_branch) gitaly_migrate(:can_be_merged) do |is_enabled| if is_enabled - gitaly_can_be_merged?(source_sha, find_branch(target_branch, true).target) + if branch = find_branch(target_branch, true) + gitaly_can_be_merged?(source_sha, branch.target) + else + false + end else rugged_can_be_merged?(source_sha, target_branch) end |