Handle case where one side deleted the file
This commit is contained in:
parent
10cf933f70
commit
f3cf40b8aa
2 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue