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 ...@@ -72,7 +72,10 @@ class Commit
# #
# This pattern supports cross-project references. # This pattern supports cross-project references.
def self.reference_pattern 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 end
def to_reference(from_project = nil) def to_reference(from_project = nil)
......
...@@ -63,7 +63,7 @@ class Issue < ActiveRecord::Base ...@@ -63,7 +63,7 @@ class Issue < ActiveRecord::Base
# This pattern supports cross-project references. # This pattern supports cross-project references.
def self.reference_pattern def self.reference_pattern
%r{ %r{
#{Project.reference_pattern}? (#{Project.reference_pattern})?
#{Regexp.escape(reference_prefix)}(?<issue>\d+) #{Regexp.escape(reference_prefix)}(?<issue>\d+)
}x }x
end end
......
...@@ -145,7 +145,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -145,7 +145,7 @@ class MergeRequest < ActiveRecord::Base
# This pattern supports cross-project references. # This pattern supports cross-project references.
def self.reference_pattern def self.reference_pattern
%r{ %r{
#{Project.reference_pattern}? (#{Project.reference_pattern})?
#{Regexp.escape(reference_prefix)}(?<merge_request>\d+) #{Regexp.escape(reference_prefix)}(?<merge_request>\d+)
}x }x
end end
......
...@@ -61,7 +61,7 @@ class Snippet < ActiveRecord::Base ...@@ -61,7 +61,7 @@ class Snippet < ActiveRecord::Base
# This pattern supports cross-project references. # This pattern supports cross-project references.
def self.reference_pattern def self.reference_pattern
%r{ %r{
#{Project.reference_pattern}? (#{Project.reference_pattern})?
#{Regexp.escape(reference_prefix)}(?<snippet>\d+) #{Regexp.escape(reference_prefix)}(?<snippet>\d+)
}x }x
end 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