diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2017-10-10 14:56:04 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-10-10 14:56:04 +0000 |
commit | 47d19c2de1df14bb3ab00d051be8e4f19f4ed7c4 (patch) | |
tree | a937896d47c846185e397528bdd6fa3e64ae78b9 /app | |
parent | 900dd7fa93ee9de3de767aa4bf5baca7e9f83348 (diff) | |
download | gitlab-ce-47d19c2de1df14bb3ab00d051be8e4f19f4ed7c4.tar.gz |
Stop using `branch_names.include?` and use `branch_exists?`
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/compare_helper.rb | 4 | ||||
-rw-r--r-- | app/models/merge_request.rb | 4 | ||||
-rw-r--r-- | app/services/quick_actions/interpret_service.rb | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb index 2c28dd81c87..8bf96c0905f 100644 --- a/app/helpers/compare_helper.rb +++ b/app/helpers/compare_helper.rb @@ -4,8 +4,8 @@ module CompareHelper to.present? && from != to && can?(current_user, :create_merge_request, project) && - project.repository.branch_names.include?(from) && - project.repository.branch_names.include?(to) + project.repository.branch_exists?(from) && + project.repository.branch_exists?(to) end def create_mr_path(from = params[:from], to = params[:to], project = @project) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 75e9bdaaa45..972a35dde4d 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -675,13 +675,13 @@ class MergeRequest < ActiveRecord::Base def source_branch_exists? return false unless self.source_project - self.source_project.repository.branch_names.include?(self.source_branch) + self.source_project.repository.branch_exists?(self.source_branch) end def target_branch_exists? return false unless self.target_project - self.target_project.repository.branch_names.include?(self.target_branch) + self.target_project.repository.branch_exists?(self.target_branch) end def merge_commit_message(include_description: false) diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index a077b3584b0..955d934838b 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -458,7 +458,7 @@ module QuickActions target_branch_param.strip end command :target_branch do |branch_name| - @updates[:target_branch] = branch_name if project.repository.branch_names.include?(branch_name) + @updates[:target_branch] = branch_name if project.repository.branch_exists?(branch_name) end desc 'Move issue from one column of the board to another' |