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
Jérome Perrin
gitlab-ce
Commits
f3cf40b8
Commit
f3cf40b8
authored
Aug 01, 2016
by
Sean McGivern
Committed by
Fatih Acet
Aug 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle case where one side deleted the file
parent
10cf933f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
lib/gitlab/conflict/file_collection.rb
lib/gitlab/conflict/file_collection.rb
+5
-3
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
f3cf40b8
...
...
@@ -140,7 +140,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
format
.
json
do
begin
render
json:
Gitlab
::
Conflict
::
FileCollection
.
new
(
@merge_request
)
rescue
Gitlab
::
Conflict
::
Parser
::
ParserError
=>
e
rescue
Gitlab
::
Conflict
::
Parser
::
ParserError
,
Gitlab
::
Conflict
::
FileCollection
::
ConflictSideMissing
=>
e
render
json:
{
message:
'Unable to resolve conflicts in the web interface for this merge request'
}
end
end
...
...
lib/gitlab/conflict/file_collection.rb
View file @
f3cf40b8
module
Gitlab
module
Conflict
class
FileCollection
class
ConflictSideMissing
<
StandardError
end
attr_reader
:merge_request
,
:our_commit
,
:their_commit
def
initialize
(
merge_request
)
...
...
@@ -39,10 +42,9 @@ module Gitlab
def
files
@files
||=
merge_index
.
conflicts
.
map
do
|
conflict
|
their_path
=
conflict
[
:theirs
][
:path
]
our_path
=
conflict
[
:ours
][
:path
]
raise
ConflictSideMissing
unless
conflict
[
:theirs
]
&&
conflict
[
:ours
]
Gitlab
::
Conflict
::
File
.
new
(
merge_index
.
merge_file
(
our_path
),
Gitlab
::
Conflict
::
File
.
new
(
merge_index
.
merge_file
(
conflict
[
:ours
][
:path
]
),
conflict
,
diff_refs:
merge_request
.
diff_refs
,
repository:
repository
)
...
...
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