Commit 0e126969 authored by Patrick Bajao's avatar Patrick Bajao

Merge branch 'kerrizor/remove-merge_ref_auto_sync-flag' into 'master'

Remove merge_ref_auto_sync flag

See merge request gitlab-org/gitlab!51624
parents da836ecd 135ecd21
......@@ -64,10 +64,6 @@ module MergeRequests
return ServiceResponse.error(message: 'Merge request is not mergeable')
end
unless merge_ref_auto_sync_enabled?
return ServiceResponse.error(message: 'Merge ref is outdated due to disabled feature')
end
unless payload.fetch(:merge_ref_head)
return ServiceResponse.error(message: 'Merge ref cannot be updated')
end
......@@ -142,7 +138,6 @@ module MergeRequests
#
# Returns true if the merge-ref does not exists or is out of sync.
def outdated_merge_ref?
return false unless merge_ref_auto_sync_enabled?
return false unless merge_request.open?
return true unless ref_head = merge_request.merge_ref_head
......@@ -157,17 +152,11 @@ module MergeRequests
end
def merge_to_ref
return true unless merge_ref_auto_sync_enabled?
params = { allow_conflicts: Feature.enabled?(:display_merge_conflicts_in_diff, project) }
result = MergeRequests::MergeToRefService.new(project, merge_request.author, params).execute(merge_request)
result[:status] == :success
end
def merge_ref_auto_sync_enabled?
Feature.enabled?(:merge_ref_auto_sync, project, default_enabled: true)
end
def merge_ref_auto_sync_lock_enabled?
Feature.enabled?(:merge_ref_auto_sync_lock, project, default_enabled: true)
end
......
---
name: merge_ref_auto_sync
introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29569
rollout_issue_url:
milestone: '12.1'
type: development
group: group::code review
default_enabled: true
......@@ -167,25 +167,6 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
end
end
context 'disabled merge ref sync feature flag' do
before do
stub_feature_flags(merge_ref_auto_sync: false)
end
it 'returns error and no payload' do
result = subject
expect(result).to be_a(ServiceResponse)
expect(result.error?).to be(true)
expect(result.message).to eq('Merge ref is outdated due to disabled feature')
expect(result.payload).to be_empty
end
it 'ignores merge-ref and updates merge status' do
expect { subject }.to change(merge_request, :merge_status).from('unchecked').to('can_be_merged')
end
end
context 'when broken' do
before do
expect(merge_request).to receive(:broken?) { true }
......@@ -305,28 +286,6 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
context 'recheck enforced' do
subject { described_class.new(merge_request).execute(recheck: true) }
context 'when MR is mergeable and merge-ref auto-sync is disabled' do
before do
stub_feature_flags(merge_ref_auto_sync: false)
merge_request.mark_as_mergeable!
end
it 'returns ServiceResponse.error' do
result = subject
expect(result).to be_a(ServiceResponse)
expect(result.error?).to be(true)
expect(result.message).to eq('Merge ref is outdated due to disabled feature')
expect(result.payload).to be_empty
end
it 'merge status is not changed' do
subject
expect(merge_request.merge_status).to eq('can_be_merged')
end
end
context 'when MR is marked as mergeable, but repo is not mergeable and MR is not opened' do
before do
# Making sure that we don't touch the merge-status after
......
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