Commit e7d8f24d authored by Gary Holtz's avatar Gary Holtz Committed by Igor Drozdov

Fix issue with the `default_merge_refs` feature flag removing version to version diffs

parent e0d2a010
...@@ -165,7 +165,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic ...@@ -165,7 +165,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
end end
def render_merge_ref_head_diff? def render_merge_ref_head_diff?
Gitlab::Utils.to_boolean(params[:diff_head]) && @merge_request.diffable_merge_ref? Gitlab::Utils.to_boolean(params[:diff_head]) && @merge_request.diffable_merge_ref? && @start_sha.nil?
end end
def note_positions def note_positions
......
---
title: Fix issue with the `default_merge_refs` feature flag removing version to version
diffs
merge_request: 50671
author:
type: fixed
...@@ -193,6 +193,29 @@ RSpec.describe Projects::MergeRequests::DiffsController do ...@@ -193,6 +193,29 @@ RSpec.describe Projects::MergeRequests::DiffsController do
end end
end end
context "with the :default_merge_ref_for_diffs flag on" do
let(:diffable_merge_ref) { true }
subject do
go(diff_head: true,
diff_id: merge_request.merge_request_diff.id,
start_sha: merge_request.merge_request_diff.start_commit_sha)
end
it "correctly generates the right diff between versions" do
MergeRequests::MergeToRefService.new(project, merge_request.author).execute(merge_request)
expect_next_instance_of(CompareService) do |service|
expect(service).to receive(:execute).with(
project,
merge_request.merge_request_diff.head_commit_sha,
straight: true)
end
subject
end
end
context 'with diff_head param passed' do context 'with diff_head param passed' do
before do before do
allow(merge_request).to receive(:diffable_merge_ref?) allow(merge_request).to receive(:diffable_merge_ref?)
......
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