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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
16d17b78
Commit
16d17b78
authored
Jan 22, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore diff comments
parent
3f7993b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
app/views/projects/diffs/_text_file.html.haml
app/views/projects/diffs/_text_file.html.haml
+2
-1
lib/gitlab/diff/highlight.rb
lib/gitlab/diff/highlight.rb
+5
-4
No files found.
app/views/projects/diffs/_text_file.html.haml
View file @
16d17b78
...
...
@@ -6,6 +6,7 @@
%table
.text-file.code.js-syntax-highlight
{
class:
too_big
?
'hide'
:
''
}
-
last_line
=
0
-
raw_diff_lines
=
diff_file
.
diff_lines
-
diff_file
.
highlighted_diff_lines
.
each_with_index
do
|
line
,
index
|
-
type
=
line
.
type
-
last_line
=
line
.
new_pos
...
...
@@ -31,7 +32,7 @@
-
if
@reply_allowed
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
&&
n
.
active?
}.
sort_by
(
&
:created_at
)
-
unless
comments
.
empty?
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
comments
,
line:
line
.
text
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
comments
,
line:
raw_diff_lines
[
index
]
.
text
-
if
last_line
>
0
=
render
"projects/diffs/match_line"
,
{
line:
""
,
...
...
lib/gitlab/diff/highlight.rb
View file @
16d17b78
...
...
@@ -12,9 +12,10 @@ module Gitlab
end
def
highlight
@diff_lines
.
each_with_index
do
|
diff_line
,
i
|
@diff_lines
.
map
.
with_index
do
|
diff_line
,
i
|
diff_line
=
diff_line
.
dup
# ignore highlighting for "match" lines
next
if
diff_line
.
type
==
'match'
||
diff_line
.
type
==
'nonewline'
next
diff_line
if
diff_line
.
type
==
'match'
||
diff_line
.
type
==
'nonewline'
rich_line
=
highlight_line
(
diff_line
,
i
)
...
...
@@ -23,9 +24,9 @@ module Gitlab
end
diff_line
.
text
=
rich_line
.
html_safe
end
@diff_lines
diff_line
end
end
private
...
...
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