Commit d92bd8e2 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'fix/gitaly-can-be-merged-for-missing-conflict-files' into 'master'

GitalyClient::ConflictsService#conflicts? should return true for conflicts with missing side

See merge request gitlab-org/gitlab-ce!16655
parents f8385188 0b965528
...@@ -25,6 +25,11 @@ module Gitlab ...@@ -25,6 +25,11 @@ module Gitlab
def conflicts? def conflicts?
list_conflict_files.any? list_conflict_files.any?
rescue GRPC::FailedPrecondition
# The server raises this exception when it encounters ConflictSideMissing, which
# means a conflict exists but its `theirs` or `ours` data is nil due to a non-existent
# file in one of the trees.
true
end end
def resolve_conflicts(target_repository, resolution, source_branch, target_branch) def resolve_conflicts(target_repository, resolution, source_branch, target_branch)
......
...@@ -365,12 +365,18 @@ describe Repository do ...@@ -365,12 +365,18 @@ describe Repository do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
context 'non-mergeable branches' do context 'non-mergeable branches without conflict sides missing' do
subject { repository.can_be_merged?('bb5206fee213d983da88c47f9cf4cc6caf9c66dc', 'feature') } subject { repository.can_be_merged?('bb5206fee213d983da88c47f9cf4cc6caf9c66dc', 'feature') }
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
end end
context 'non-mergeable branches with conflict sides missing' do
subject { repository.can_be_merged?('conflict-missing-side', 'conflict-start') }
it { is_expected.to be_falsey }
end
context 'non merged branch' do context 'non merged branch' do
subject { repository.merged_to_root_ref?('fix') } subject { repository.merged_to_root_ref?('fix') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment