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
7e03b402
Commit
7e03b402
authored
Mar 15, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return an empty Array when there aren't lines to parse.
parent
64d0dd18
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
lib/gitlab/diff/parser.rb
lib/gitlab/diff/parser.rb
+2
-0
spec/lib/gitlab/diff/parser_spec.rb
spec/lib/gitlab/diff/parser_spec.rb
+5
-0
No files found.
lib/gitlab/diff/parser.rb
View file @
7e03b402
...
@@ -4,6 +4,8 @@ module Gitlab
...
@@ -4,6 +4,8 @@ module Gitlab
include
Enumerable
include
Enumerable
def
parse
(
lines
)
def
parse
(
lines
)
return
[]
if
lines
.
blank?
@lines
=
lines
@lines
=
lines
line_obj_index
=
0
line_obj_index
=
0
line_old
=
1
line_old
=
1
...
...
spec/lib/gitlab/diff/parser_spec.rb
View file @
7e03b402
...
@@ -90,4 +90,9 @@ eos
...
@@ -90,4 +90,9 @@ eos
end
end
end
end
end
end
context
'when lines is empty'
do
it
{
expect
(
parser
.
parse
([])).
to
eq
([])
}
it
{
expect
(
parser
.
parse
(
nil
)).
to
eq
([])
}
end
end
end
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