Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
52e20227
Commit
52e20227
authored
Mar 08, 2021
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further reduce blame instantiations
parent
045587e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
lib/gitlab/git/blame.rb
lib/gitlab/git/blame.rb
+5
-5
No files found.
lib/gitlab/git/blame.rb
View file @
52e20227
...
...
@@ -38,9 +38,10 @@ 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
commits
[
commit_id
]
=
nil
unless
commits
.
key?
(
commit_id
)
info
[
lineno
]
=
[
commit_id
,
old_lineno
]
# 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
commits
[
m
[
1
]]
=
nil
unless
commits
.
key?
(
m
[
1
])
info
[
m
[
3
].
to_i
]
=
[
m
[
1
],
m
[
2
].
to_i
]
end
end
...
...
@@ -50,8 +51,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment