summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@gmail.com>2014-10-19 16:09:38 +0200
committerCiro Santilli <ciro.santilli@gmail.com>2014-12-28 23:53:27 +0100
commitcd688a60111853f63413a87ad6632ad57368e886 (patch)
tree7213f737fa99bc91141e53a637ba95530dfcfdaf /app/models/commit.rb
parentc8bb171664de94778d4e6eba7773596b265f9efb (diff)
downloadgitlab-ce-cd688a60111853f63413a87ad6632ad57368e886.tar.gz
Replace regex methods by string ones since faster
and more readable.
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 37dd371ec00..baccf286740 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -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,11 +87,11 @@ class Commit
#
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
def description
- title_end = safe_message.index(/\n/)
+ 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)
+ safe_message.split("\n", 2)[1].try(:chomp)
end
end