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
Léo-Paul Géneau
gitlab-ce
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
Show 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 @@ module Gitlab
...
@@ -70,7 +70,7 @@ module Gitlab
def
find_changed_line_pairs
(
lines
)
def
find_changed_line_pairs
(
lines
)
# Prefixes of all diff lines, indicating their types
# Prefixes of all diff lines, indicating their types
# For example: `" - + -+ ---+++ --+ -++"`
# 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
=
[]
changed_line_pairs
=
[]
line_prefixes
.
scan
(
LINE_PAIRS_PATTERN
)
do
line_prefixes
.
scan
(
LINE_PAIRS_PATTERN
)
do
...
...
spec/lib/gitlab/diff/inline_diff_spec.rb
View file @
b7a5125f
...
@@ -31,6 +31,10 @@ describe Gitlab::Diff::InlineDiff do
...
@@ -31,6 +31,10 @@ describe Gitlab::Diff::InlineDiff do
expect
(
subject
[
7
]).
to
eq
([
17
..
17
])
expect
(
subject
[
7
]).
to
eq
([
17
..
17
])
expect
(
subject
[
8
]).
to
be_nil
expect
(
subject
[
8
]).
to
be_nil
end
end
it
'can handle unchanged empty lines'
do
expect
{
described_class
.
for_lines
([
'- bar'
,
'+ baz'
,
''
])
}.
not_to
raise_error
end
end
end
describe
"#inline_diffs"
do
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