Commit 1a9da917 authored by Robert Speicher's avatar Robert Speicher

Surround Project.reference_pattern in parenthesis inside other patterns

parent 5cc9b17b
......@@ -72,7 +72,10 @@ class Commit
#
# This pattern supports cross-project references.
def self.reference_pattern
%r{(?:#{Project.reference_pattern}#{reference_prefix})?(?<commit>\h{6,40})}
%r{
(?:#{Project.reference_pattern}#{reference_prefix})?
(?<commit>\h{6,40})
}x
end
def to_reference(from_project = nil)
......
......@@ -63,7 +63,7 @@ class Issue < ActiveRecord::Base
# This pattern supports cross-project references.
def self.reference_pattern
%r{
#{Project.reference_pattern}?
(#{Project.reference_pattern})?
#{Regexp.escape(reference_prefix)}(?<issue>\d+)
}x
end
......
......@@ -145,7 +145,7 @@ class MergeRequest < ActiveRecord::Base
# This pattern supports cross-project references.
def self.reference_pattern
%r{
#{Project.reference_pattern}?
(#{Project.reference_pattern})?
#{Regexp.escape(reference_prefix)}(?<merge_request>\d+)
}x
end
......
......@@ -61,7 +61,7 @@ class Snippet < ActiveRecord::Base
# This pattern supports cross-project references.
def self.reference_pattern
%r{
#{Project.reference_pattern}?
(#{Project.reference_pattern})?
#{Regexp.escape(reference_prefix)}(?<snippet>\d+)
}x
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment