Skip to content
Snippets Groups Projects
Commit 1a9da917 authored by Robert Speicher's avatar Robert Speicher
Browse files

Surround Project.reference_pattern in parenthesis inside other patterns

parent 5cc9b17b
No related branches found
No related tags found
1 merge request!641Add to_reference method to referable models
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment