Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git/blame.rb')
-rw-r--r--lib/gitlab/git/blame.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/gitlab/git/blame.rb b/lib/gitlab/git/blame.rb
index b118eda37f8..9e24306c05e 100644
--- a/lib/gitlab/git/blame.rb
+++ b/lib/gitlab/git/blame.rb
@@ -38,9 +38,11 @@ module Gitlab
if line[0, 1] == "\t"
lines << line[1, line.size]
elsif m = /^(\w{40}) (\d+) (\d+)/.match(line)
- commit_id, old_lineno, lineno = m[1], m[2].to_i, m[3].to_i
+ # Removed these instantiations for performance but keeping them for reference:
+ # commit_id, old_lineno, lineno = m[1], m[2].to_i, m[3].to_i
+ commit_id = m[1]
commits[commit_id] = nil unless commits.key?(commit_id)
- info[lineno] = [commit_id, old_lineno]
+ info[m[3].to_i] = [commit_id, m[2].to_i]
end
end
@@ -50,8 +52,7 @@ module Gitlab
# get it together
info.sort.each do |lineno, (commit_id, old_lineno)|
- commit = commits[commit_id]
- final << BlameLine.new(lineno, old_lineno, commit, lines[lineno - 1])
+ final << BlameLine.new(lineno, old_lineno, commits[commit_id], lines[lineno - 1])
end
@lines = final