summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2016-01-29 19:49:07 -0500
committerRobert Speicher <rspeicher@gmail.com>2016-01-29 19:52:29 -0500
commitd97742570fce0512eddb6dc6c924d541aa4f57e4 (patch)
treea36e3b79cd3439b4d4d6de11b9e204f85e4131df /app/models/commit.rb
parentdec21517186f7406da2efd76569b4dff4fa711e0 (diff)
downloadgitlab-ce-d97742570fce0512eddb6dc6c924d541aa4f57e4.tar.gz
Increase the minimum length for commit SHA matching to 7rs-issue-12706
This is the git default and will help to prevent false positive matches. Closes #12706
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 0ba7b584d91..23b771aebb7 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -68,18 +68,18 @@ class Commit
# Pattern used to extract commit references from text
#
- # The SHA can be between 6 and 40 hex characters.
+ # The SHA can be between 7 and 40 hex characters.
#
# This pattern supports cross-project references.
def self.reference_pattern
%r{
(?:#{Project.reference_pattern}#{reference_prefix})?
- (?<commit>\h{6,40})
+ (?<commit>\h{7,40})
}x
end
def self.link_reference_pattern
- super("commit", /(?<commit>\h{6,40})/)
+ super("commit", /(?<commit>\h{7,40})/)
end
def to_reference(from_project = nil)