summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb25
1 files changed, 13 insertions, 12 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 212229649fc..e0461809e10 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -10,12 +10,12 @@ class Commit
# Used to prevent 500 error on huge commits by suppressing diff
#
# User can force display of diff above this size
- DIFF_SAFE_FILES = 100
- DIFF_SAFE_LINES = 5000
+ DIFF_SAFE_FILES = 100 unless defined?(DIFF_SAFE_FILES)
+ DIFF_SAFE_LINES = 5000 unless defined?(DIFF_SAFE_LINES)
# Commits above this size will not be rendered in HTML
- DIFF_HARD_LIMIT_FILES = 1000
- DIFF_HARD_LIMIT_LINES = 50000
+ DIFF_HARD_LIMIT_FILES = 1000 unless defined?(DIFF_HARD_LIMIT_FILES)
+ DIFF_HARD_LIMIT_LINES = 50000 unless defined?(DIFF_HARD_LIMIT_LINES)
class << self
def decorate(commits)
@@ -75,11 +75,11 @@ class Commit
return no_commit_message if title.blank?
- title_end = title.index(/\n/)
+ title_end = title.index("\n")
if (!title_end && title.length > 100) || (title_end && title_end > 100)
title[0..79] << "&hellip;".html_safe
else
- title.split(/\n/, 2).first
+ title.split("\n", 2).first
end
end
@@ -87,12 +87,13 @@ class Commit
#
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
def description
- title_end = safe_message.index(/\n/)
- @description ||= if (!title_end && safe_message.length > 100) || (title_end && title_end > 100)
- "&hellip;".html_safe << safe_message[80..-1]
- else
- safe_message.split(/\n/, 2)[1].try(:chomp)
- end
+ title_end = safe_message.index("\n")
+ @description ||=
+ if (!title_end && safe_message.length > 100) || (title_end && title_end > 100)
+ "&hellip;".html_safe << safe_message[80..-1]
+ else
+ safe_message.split("\n", 2)[1].try(:chomp)
+ end
end
def description?