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
Boxiang Sun
gitlab-ce
Commits
bea83d25
Commit
bea83d25
authored
Oct 27, 2016
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove an extra leading space from diff content
parent
3a8a7c12
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
26 deletions
+28
-26
app/assets/javascripts/diff.js
app/assets/javascripts/diff.js
+0
-4
app/assets/stylesheets/pages/diff.scss
app/assets/stylesheets/pages/diff.scss
+18
-15
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+3
-4
app/views/projects/diffs/_line.html.haml
app/views/projects/diffs/_line.html.haml
+2
-2
changelogs/unreleased/remove-heading-space-from-diff-content.yml
...ogs/unreleased/remove-heading-space-from-diff-content.yml
+4
-0
spec/helpers/diff_helper_spec.rb
spec/helpers/diff_helper_spec.rb
+1
-1
No files found.
app/assets/javascripts/diff.js
View file @
bea83d25
...
...
@@ -43,10 +43,6 @@
bottom
:
unfoldBottom
,
offset
:
offset
,
unfold
:
unfold
,
// indent is used to compensate for single space indent to fit
// '+' and '-' prepended to diff lines,
// see https://gitlab.com/gitlab-org/gitlab-ce/issues/707
indent
:
1
,
view
:
file
.
data
(
'
view
'
)
};
return
$
.
get
(
link
,
params
,
function
(
response
)
{
...
...
app/assets/stylesheets/pages/diff.scss
View file @
bea83d25
...
...
@@ -92,20 +92,6 @@
&
.noteable_line
{
position
:
relative
;
&
.old
{
&
:
:
before
{
content
:
'-'
;
position
:
absolute
;
}
}
&
.new
{
&
:
:
before
{
content
:
'+'
;
position
:
absolute
;
}
}
}
span
{
...
...
@@ -151,8 +137,9 @@
.line_content
{
display
:
block
;
margin
:
0
;
padding
:
0
0
.5em
;
padding
:
0
1
.5em
;
border
:
none
;
position
:
relative
;
&
.parallel
{
display
:
table-cell
;
...
...
@@ -161,6 +148,22 @@
word-break
:
break-all
;
}
}
&
.old
{
&
:
:
before
{
content
:
'-'
;
position
:
absolute
;
left
:
0
.5em
;
}
}
&
.new
{
&
:
:
before
{
content
:
'+'
;
position
:
absolute
;
left
:
0
.5em
;
}
}
}
.text-file.diff-wrap-lines
table
.line_holder
td
span
{
...
...
app/helpers/diff_helper.rb
View file @
bea83d25
...
...
@@ -51,12 +51,11 @@ module DiffHelper
html
.
html_safe
end
def
diff_line_content
(
line
,
line_type
=
nil
)
def
diff_line_content
(
line
)
if
line
.
blank?
"
"
.
html_safe
" "
.
html_safe
else
line
[
0
]
=
' '
if
%w[new old]
.
include?
(
line_type
)
line
line
.
sub
(
/^[\-+ ]/
,
''
).
html_safe
end
end
...
...
app/views/projects/diffs/_line.html.haml
View file @
bea83d25
...
...
@@ -25,9 +25,9 @@
%a
{
href:
"##{line_code}"
,
data:
{
linenumber:
link_text
}}
%td
.line_content.noteable_line
{
class:
type
,
data:
(
diff_view_line_data
(
line_code
,
diff_file
.
position
(
line
),
type
)
unless
plain
)
}
<
-
if
email
%pre
=
diff_line_content
(
line
.
text
,
type
)
%pre
=
diff_line_content
(
line
.
text
)
-
else
=
diff_line_content
(
line
.
text
,
type
)
=
diff_line_content
(
line
.
text
)
-
discussions
=
local_assigns
.
fetch
(
:discussions
,
nil
)
-
if
discussions
&&
!
line
.
meta?
...
...
changelogs/unreleased/remove-heading-space-from-diff-content.yml
0 → 100644
View file @
bea83d25
---
title
:
Remove an extra leading space from diff paste data
merge_request
:
7133
author
:
Hiroyuki Sato
spec/helpers/diff_helper_spec.rb
View file @
bea83d25
...
...
@@ -61,7 +61,7 @@ describe DiffHelper do
describe
'#diff_line_content'
do
it
'returns non breaking space when line is empty'
do
expect
(
diff_line_content
(
nil
)).
to
eq
(
'
'
)
expect
(
diff_line_content
(
nil
)).
to
eq
(
' '
)
end
it
'returns the line itself'
do
...
...
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