Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
b7a5125f
Commit
b7a5125f
authored
Dec 06, 2017
by
Martin Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #39233 - 500 in merge request
- handle unchanged empty lines in inline diff
parent
f1a98477
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
changelogs/unreleased/15774-fix-39233-500-in-merge-request.yml
...elogs/unreleased/15774-fix-39233-500-in-merge-request.yml
+5
-0
lib/gitlab/diff/inline_diff.rb
lib/gitlab/diff/inline_diff.rb
+1
-1
spec/lib/gitlab/diff/inline_diff_spec.rb
spec/lib/gitlab/diff/inline_diff_spec.rb
+4
-0
No files found.
changelogs/unreleased/15774-fix-39233-500-in-merge-request.yml
0 → 100644
View file @
b7a5125f
---
title
:
'
fix
#39233
-
500
in
merge
request'
merge_request
:
15774
author
:
Martin Nowak
type
:
fixed
lib/gitlab/diff/inline_diff.rb
View file @
b7a5125f
...
...
@@ -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 @
b7a5125f
...
...
@@ -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