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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
71033c9e
Commit
71033c9e
authored
May 22, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle broken diffs gracefully
parent
86ae7278
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
app/models/merge_request.rb
app/models/merge_request.rb
+16
-4
No files found.
app/models/merge_request.rb
View file @
71033c9e
...
@@ -118,7 +118,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -118,7 +118,7 @@ class MergeRequest < ActiveRecord::Base
end
end
def
broken_diffs?
def
broken_diffs?
diffs
==
[
Gitlab
::
Git
::
Diff
::
BROKEN_DIFF
]
diffs
==
broken_diffs
end
end
def
valid_diffs?
def
valid_diffs?
...
@@ -214,10 +214,22 @@ class MergeRequest < ActiveRecord::Base
...
@@ -214,10 +214,22 @@ class MergeRequest < ActiveRecord::Base
end
end
def
dump_diffs
(
diffs
)
def
dump_diffs
(
diffs
)
if
broken_diffs?
broken_diffs
else
diffs
.
map
(
&
:to_hash
)
diffs
.
map
(
&
:to_hash
)
end
end
end
def
load_diffs
(
raw
)
if
raw
==
broken_diffs
broken_diffs
else
raw
.
map
{
|
hash
|
Gitlab
::
Git
::
Diff
.
new
(
hash
)
}
end
end
def
load_diffs
(
array
)
def
broken_diffs
array
.
map
{
|
hash
|
Gitlab
::
Git
::
Diff
.
new
(
hash
)
}
[
Gitlab
::
Git
::
Diff
::
BROKEN_DIFF
]
end
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