summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-21 11:49:13 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-21 11:49:13 -0800
commit0c4bb8491027cab1306855e32e6bb144792e7e3a (patch)
treeaaabe4e696ee9adc6822b05e75eb1fd0b89eb2ff /lib
parent1050f5230eec21cf47d5af262a1b3e62c07fec5d (diff)
parentb21a2d821a4e16aba1609dfa1e01ba455e8ccd8f (diff)
downloadgitlab-ce-0c4bb8491027cab1306855e32e6bb144792e7e3a.tar.gz
Merge pull request #7762 from jubianchi/commit-closing-issues
Allow commit messages to close several issues at once
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/closing_issue_extractor.rb19
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