diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2019-06-03 14:56:33 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-06-03 14:56:33 +0200 |
commit | 6cb750a2bb7e1720413a7c42ec4afebaa3f2f4d2 (patch) | |
tree | 2f94f96a1fcb0c692f8e94e924a733d4bad9a59b /app/models/merge_request.rb | |
parent | 51a66a581f4d0662d04c432aa4b014dd4b634fc9 (diff) | |
parent | 3dcf3cfde35d1506c7196634080849d002251a41 (diff) | |
download | gitlab-ce-6cb750a2bb7e1720413a7c42ec4afebaa3f2f4d2.tar.gz |
Merge dev.gitlab.org master into GitLab.com master
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 2602738901b..ab914e84650 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -589,6 +589,8 @@ class MergeRequest < ApplicationRecord return end + [:source_branch, :target_branch].each { |attr| validate_branch_name(attr) } + if opened? similar_mrs = target_project .merge_requests @@ -609,6 +611,16 @@ class MergeRequest < ApplicationRecord end end + def validate_branch_name(attr) + return unless changes_include?(attr) + + branch = read_attribute(attr) + + return unless branch + + errors.add(attr) unless Gitlab::GitRefValidator.validate_merge_request_branch(branch) + end + def validate_target_project return true if target_project.merge_requests_enabled? |