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
Tatuya Kamada
gitlab-ce
Commits
3fe18525
Commit
3fe18525
authored
Jul 31, 2016
by
Stan Hu
Committed by
Rémy Coutable
Aug 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trim extra displayed carriage returns in diffs and files with CRLFs
Closes #20440
parent
e91fe755
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
2 deletions
+16
-2
CHANGELOG
CHANGELOG
+1
-0
lib/rouge/formatters/html_gitlab.rb
lib/rouge/formatters/html_gitlab.rb
+1
-1
spec/lib/gitlab/highlight_spec.rb
spec/lib/gitlab/highlight_spec.rb
+12
-0
spec/support/test_env.rb
spec/support/test_env.rb
+2
-1
No files found.
CHANGELOG
View file @
3fe18525
...
@@ -44,6 +44,7 @@ v 8.10.3 (unreleased)
...
@@ -44,6 +44,7 @@ v 8.10.3 (unreleased)
- Properly abort a merge when merge conflicts occur
- Properly abort a merge when merge conflicts occur
- Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured.
- Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured.
- Fix Import/Export issue importing milestones and labels not associated properly
- Fix Import/Export issue importing milestones and labels not associated properly
- Trim extra displayed carriage returns in diffs and files with CRLFs
v 8.10.2
v 8.10.2
- User can now search branches by name. !5144
- User can now search branches by name. !5144
...
...
lib/rouge/formatters/html_gitlab.rb
View file @
3fe18525
...
@@ -18,7 +18,7 @@ module Rouge
...
@@ -18,7 +18,7 @@ module Rouge
is_first
=
false
is_first
=
false
yield
%(<span id="LC#{@line_number}" class="line">)
yield
%(<span id="LC#{@line_number}" class="line">)
line
.
each
{
|
token
,
value
|
yield
span
(
token
,
value
)
}
line
.
each
{
|
token
,
value
|
yield
span
(
token
,
value
.
chomp
)
}
yield
%(</span>)
yield
%(</span>)
@line_number
+=
1
@line_number
+=
1
...
...
spec/lib/gitlab/highlight_spec.rb
View file @
3fe18525
...
@@ -17,6 +17,18 @@ describe Gitlab::Highlight, lib: true do
...
@@ -17,6 +17,18 @@ describe Gitlab::Highlight, lib: true do
expect
(
lines
[
21
]).
to
eq
(
%Q{<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
\n
}
)
expect
(
lines
[
21
]).
to
eq
(
%Q{<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
\n
}
)
expect
(
lines
[
26
]).
to
eq
(
%Q{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>
\n
}
)
expect
(
lines
[
26
]).
to
eq
(
%Q{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>
\n
}
)
end
end
describe
'with CRLF'
do
let
(
:branch
)
{
'crlf-diff'
}
let
(
:blob
)
{
repository
.
blob_at_branch
(
branch
,
path
)
}
let
(
:lines
)
do
Gitlab
::
Highlight
.
highlight_lines
(
project
.
repository
,
'crlf-diff-test'
,
'files/whitespace'
)
end
it
'strips extra LFs'
do
expect
(
lines
[
0
]).
to
eq
(
"<span id=
\"
LC1
\"
class=
\"
line
\"
>test </span>"
)
end
end
end
end
describe
'custom highlighting from .gitattributes'
do
describe
'custom highlighting from .gitattributes'
do
...
...
spec/support/test_env.rb
View file @
3fe18525
...
@@ -21,7 +21,8 @@ module TestEnv
...
@@ -21,7 +21,8 @@ module TestEnv
'expand-collapse-diffs'
=>
'4842455'
,
'expand-collapse-diffs'
=>
'4842455'
,
'expand-collapse-files'
=>
'025db92'
,
'expand-collapse-files'
=>
'025db92'
,
'expand-collapse-lines'
=>
'238e82d'
,
'expand-collapse-lines'
=>
'238e82d'
,
'video'
=>
'8879059'
'video'
=>
'8879059'
,
'crlf-diff'
=>
'5938907'
}
}
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
...
...
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