summaryrefslogtreecommitdiff
path: root/spec/presenters
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-05-11 16:23:02 +0100
committerSean McGivern <sean@gitlab.com>2017-05-12 20:47:51 +0100
commitad2bfeb85756db8c4cea9290be743665efd1c918 (patch)
treecf51b926c348db7a7f5df26117a692f55416fe25 /spec/presenters
parentaec53bab05afd0a20b15bd9311643f8bf5efd140 (diff)
downloadgitlab-ce-ad2bfeb85756db8c4cea9290be743665efd1c918.tar.gz
Fix conflict resolution from corrupted upstreamfix-conflict-resolution-with-corrupt-repos
I don't know why this happens exactly, but given an upstream and fork repository from a customer, both of which required GC, resolving conflicts would corrupt the fork so badly that it couldn't be cloned. This isn't a perfect fix for that case, because the MR may still need to be merged manually, but it does ensure that the repository is at least usable. My best guess is that when we generate the index for the conflict resolution (which we previously did in the target project), we obtain a reference to an OID that doesn't exist in the source, even though we already fetch the refs from the target into the source. Explicitly setting the source project as the place to get the merge index from seems to prevent repository corruption in this way.
Diffstat (limited to 'spec/presenters')
-rw-r--r--spec/presenters/merge_request_presenter_spec.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/presenters/merge_request_presenter_spec.rb b/spec/presenters/merge_request_presenter_spec.rb
index e599ddaf943..44720fc4448 100644
--- a/spec/presenters/merge_request_presenter_spec.rb
+++ b/spec/presenters/merge_request_presenter_spec.rb
@@ -73,12 +73,12 @@ describe MergeRequestPresenter do
describe '#conflict_resolution_path' do
let(:project) { create :empty_project }
let(:user) { create :user }
- let(:path) { described_class.new(resource, current_user: user).conflict_resolution_path }
+ let(:presenter) { described_class.new(resource, current_user: user) }
+ let(:path) { presenter.conflict_resolution_path }
context 'when MR cannot be resolved in UI' do
it 'does not return conflict resolution path' do
- allow(resource).to receive(:conflicts_can_be_resolved_in_ui?) { true }
- allow(resource).to receive(:conflicts_can_be_resolved_by?).with(user) { false }
+ allow(presenter).to receive_message_chain(:conflicts, :can_be_resolved_in_ui?) { false }
expect(path).to be_nil
end
@@ -86,8 +86,8 @@ describe MergeRequestPresenter do
context 'when conflicts cannot be resolved by user' do
it 'does not return conflict resolution path' do
- allow(resource).to receive(:conflicts_can_be_resolved_in_ui?) { false }
- allow(resource).to receive(:conflicts_can_be_resolved_by?).with(user) { true }
+ allow(presenter).to receive_message_chain(:conflicts, :can_be_resolved_in_ui?) { true }
+ allow(presenter).to receive_message_chain(:conflicts, :can_be_resolved_by?).with(user) { false }
expect(path).to be_nil
end
@@ -95,8 +95,8 @@ describe MergeRequestPresenter do
context 'when able to access conflict resolution UI' do
it 'does return conflict resolution path' do
- allow(resource).to receive(:conflicts_can_be_resolved_in_ui?) { true }
- allow(resource).to receive(:conflicts_can_be_resolved_by?).with(user) { true }
+ allow(presenter).to receive_message_chain(:conflicts, :can_be_resolved_in_ui?) { true }
+ allow(presenter).to receive_message_chain(:conflicts, :can_be_resolved_by?).with(user) { true }
expect(path)
.to eq("/#{project.full_path}/merge_requests/#{resource.iid}/conflicts")