Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
3d6a76ae5b52
Commit
2f92e920
authored
Dec 06, 2017
by
Martin Nowak
Browse files
fix #39233 - 500 in merge request
- handle unchanged empty lines in inline diff
parent
f6335c81dd22
Changes
3
Hide whitespace changes
Inline
Side-by-side
changelogs/unreleased/15774-fix-39233-500-in-merge-request.yml
0 → 100644
View file @
3d6a76ae
---
title
:
'
fix
#39233
-
500
in
merge
request'
merge_request
:
15774
author
:
Martin Nowak
type
:
fixed
lib/gitlab/diff/inline_diff.rb
View file @
3d6a76ae
...
...
@@ -70,7 +70,7 @@ def for_lines(lines)
def
find_changed_line_pairs
(
lines
)
# Prefixes of all diff lines, indicating their types
# For example: `" - + -+ ---+++ --+ -++"`
line_prefixes
=
lines
.
each_with_object
(
""
)
{
|
line
,
s
|
s
<<
line
[
0
]
}.
gsub
(
/[^ +-]/
,
' '
)
line_prefixes
=
lines
.
each_with_object
(
""
)
{
|
line
,
s
|
s
<<
(
line
[
0
]
||
' '
)
}.
gsub
(
/[^ +-]/
,
' '
)
changed_line_pairs
=
[]
line_prefixes
.
scan
(
LINE_PAIRS_PATTERN
)
do
...
...
spec/lib/gitlab/diff/inline_diff_spec.rb
View file @
3d6a76ae
...
...
@@ -31,6 +31,10 @@ class Test
expect
(
subject
[
7
]).
to
eq
([
17
..
17
])
expect
(
subject
[
8
]).
to
be_nil
end
it
'can handle unchanged empty lines'
do
expect
{
described_class
.
for_lines
([
'- bar'
,
'+ baz'
,
''
])
}.
not_to
raise_error
end
end
describe
"#inline_diffs"
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