diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-05-04 11:09:21 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-04 11:09:21 +0300 |
commit | b64a37c4ed5561d423ee607f9821b75fd0337168 (patch) | |
tree | 7b10e0e1938f871a2a228fe38adf3641ef6f5ce5 /app/models/issue.rb | |
parent | 8983ade27df200f7f9376d61de17f329d9d27a33 (diff) |
Allow to create new branch and empty WIP merge request from issue page
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 305fc01f041..78bde6820da 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -143,6 +143,14 @@ class Issue < ActiveRecord::Base branches_with_iid - branches_with_merge_request end + # Returns boolean if a related branch exists for the current issue + # ignores merge requests branchs + def has_related_branch? + project.repository.branch_names.any? do |branch| + /\A#{iid}-(?!\d+-stable)/i =~ branch + end + end + # To allow polymorphism with MergeRequest. def source_project project |