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
5bdcdf56
Commit
5bdcdf56
authored
Aug 10, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fast blame
parent
ce30eb2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
app/controllers/projects/blame_controller.rb
app/controllers/projects/blame_controller.rb
+1
-1
app/views/projects/blame/show.html.haml
app/views/projects/blame/show.html.haml
+14
-13
No files found.
app/controllers/projects/blame_controller.rb
View file @
5bdcdf56
...
@@ -7,7 +7,7 @@ class Projects::BlameController < Projects::ApplicationController
...
@@ -7,7 +7,7 @@ class Projects::BlameController < Projects::ApplicationController
before_action
:authorize_download_code!
before_action
:authorize_download_code!
def
show
def
show
@blob
=
@repository
.
blob_at
(
@commit
.
id
,
@path
)
@blame
=
Gitlab
::
Git
::
Blame
.
new
(
@repository
,
@commit
.
id
,
@path
)
@blame
=
Gitlab
::
Git
::
Blame
.
new
(
@repository
,
@commit
.
id
,
@path
)
@blob
=
@blame
.
blob
end
end
end
end
app/views/projects/blame/show.html.haml
View file @
5bdcdf56
...
@@ -12,25 +12,26 @@
...
@@ -12,25 +12,26 @@
=
render
"projects/blob/actions"
=
render
"projects/blob/actions"
.file-content.blame.highlight
.file-content.blame.highlight
%table
%table
-
@blame
.
each
do
|
commit
,
lines
,
since
|
-
current_line
=
1
-
commit
=
Commit
.
new
(
commit
,
@project
)
-
@blame
.
each
do
|
raw_commit
,
line
|
%tr
%tr
%td
.blame-commit
%td
.blame-commit
%span
.commit
%span
.commit
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
),
class:
"commit_short_id"
-
unless
@prev_commit
&&
@prev_commit
.
sha
==
raw_commit
.
sha
-
commit
=
Commit
.
new
(
raw_commit
,
@project
)
=
commit_author_link
(
commit
,
avatar:
true
,
size:
16
)
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
),
class:
"commit_short_id"
=
link_to_gfm
truncate
(
commit
.
title
,
length:
20
),
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
"row_title"
=
commit_author_link
(
commit
,
avatar:
true
,
size:
16
)
=
link_to_gfm
truncate
(
commit
.
title
,
length:
20
),
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
"row_title"
-
@prev_commit
=
raw_commit
%td
.lines.blame-numbers
%td
.lines.blame-numbers
%pre
%pre
-
(
since
...
(
since
+
lines
.
count
)).
each
do
|
i
|
=
current_line
=
i
-
current_line
+=
1
\
%td
.lines
%td
.lines
%pre
{
class:
'code highlight white'
}
%pre
{
class:
'code highlight white'
}
%code
%code
:erb
:erb
<%
lines
.
each
do
|
line
|
%>
<%=
highlight
(
@blob
.
name
,
line
,
nowrap:
true
,
continue:
true
).
html_safe
%>
<%=
highlight
(
@blob
.
name
,
line
,
nowrap:
true
,
continue:
true
).
html_safe
%>
<%
end
%>
\ No newline at end of file
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