diff options
author | jubianchi <contact@jubianchi.fr> | 2014-09-17 21:08:35 +0400 |
---|---|---|
committer | jubianchi <contact@jubianchi.fr> | 2015-01-20 12:45:48 +0300 |
commit | b21a2d821a4e16aba1609dfa1e01ba455e8ccd8f (patch) | |
tree | bc17b71af51eebc70df294422bc7acebf5e30506 /lib/gitlab/closing_issue_extractor.rb | |
parent | 0af2a161fa55a4abd7f8248b25a7361b209ecc4a (diff) |
Allow commit messages to close several issues at once (thanks @123Haynes
for his work and help)
Diffstat (limited to 'lib/gitlab/closing_issue_extractor.rb')
-rw-r--r-- | lib/gitlab/closing_issue_extractor.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/gitlab/closing_issue_extractor.rb b/lib/gitlab/closing_issue_extractor.rb index 401e6e047b1..a9fd59f03d9 100644 --- a/lib/gitlab/closing_issue_extractor.rb +++ b/lib/gitlab/closing_issue_extractor.rb @@ -3,14 +3,19 @@ module Gitlab ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern) def self.closed_by_message_in_project(message, project) - md = ISSUE_CLOSING_REGEX.match(message) - if md - extractor = Gitlab::ReferenceExtractor.new - extractor.analyze(md[0], project) - extractor.issues_for(project) - else - [] + issues = [] + + unless message.nil? + md = message.scan(ISSUE_CLOSING_REGEX) + + md.each do |ref| + extractor = Gitlab::ReferenceExtractor.new + extractor.analyze(ref[0], project) + issues += extractor.issues_for(project) + end end + + issues.uniq end end end |