summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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