From 1a9da9178cfd25190997b621e428a5c7ce467cd1 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 15 May 2015 16:10:55 -0400 Subject: Surround Project.reference_pattern in parenthesis inside other patterns --- app/models/commit.rb | 5 ++++- app/models/issue.rb | 2 +- app/models/merge_request.rb | 2 +- app/models/snippet.rb | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'app/models') 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})?(?\h{6,40})} + %r{ + (?:#{Project.reference_pattern}#{reference_prefix})? + (?\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)}(?\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)}(?\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)}(?\d+) }x end -- cgit v1.2.1