summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-05-15 16:10:55 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-05-26 15:49:22 -0400
commit1a9da9178cfd25190997b621e428a5c7ce467cd1 (patch)
treea5edb5df2ba7d76e9fdc29e7eb7615e60fbb404a /app/models
parent5cc9b17b8a7d7a8081fa60ea75f6cf423fbddbc5 (diff)
downloadgitlab-ce-1a9da9178cfd25190997b621e428a5c7ce467cd1.tar.gz
Surround Project.reference_pattern in parenthesis inside other patterns
Diffstat (limited to 'app/models')
-rw-r--r--app/models/commit.rb5
-rw-r--r--app/models/issue.rb2
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--app/models/snippet.rb2
4 files changed, 7 insertions, 4 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 2c244fc0410..f02fe240540 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -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)
diff --git a/app/models/issue.rb b/app/models/issue.rb
index ea6b9329b07..2456b7d0dc1 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -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
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 6c90d09b866..c57016dd6a2 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -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
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index d1619071f49..3ab9e834c63 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -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