Commit cf4abe87 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '276917-remove-default_merge_ref_for_diffs-feature-flag' into 'master'

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

See merge request gitlab-org/gitlab!50671
parents f26eeac1 e7d8f24d
......@@ -165,7 +165,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
end
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
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
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
before do
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