Commit 045587e0 authored by Robert May's avatar Robert May

Reduce instantiations when building blame

parent 1ccbd72f
...@@ -19,16 +19,18 @@ module Gitlab ...@@ -19,16 +19,18 @@ module Gitlab
commit = Commit.new(commit, project) commit = Commit.new(commit, project)
commit.lazy_author # preload author commit.lazy_author # preload author
sha = commit.sha if prev_sha != commit.sha
if prev_sha != sha
groups << current_group if current_group groups << current_group if current_group
current_group = { commit: commit, lines: [] } current_group = { commit: commit, lines: [] }
end end
line = highlighted_lines[i].html_safe if highlight if highlight
current_group[:lines] << line current_group[:lines] << highlighted_lines[i].html_safe
else
current_group[:lines] << line
end
prev_sha = sha prev_sha = commit.sha
i += 1 i += 1
end end
groups << current_group if current_group groups << current_group if current_group
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment