Commit 927fcc29 authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch 'sh-disable-rebase-on-conflicts' into 'master'

Prevent rebase from being run in quick action when there are conflicts

See merge request gitlab-org/gitlab!51243
parents 2b550cc5 99422e7d
---
title: Prevent rebase from being run in quick action when there are conflicts
merge_request: 51243
author:
type: fixed
......@@ -57,6 +57,11 @@ module Gitlab
access_check.can_push_to_branch?(merge_request.source_branch)
end
command :rebase do
if quick_action_target.cannot_be_merged?
@execution_message[:rebase] = _('This merge request cannot be rebased while there are conflicts.')
next
end
if quick_action_target.rebase_in_progress?
@execution_message[:rebase] = _('A rebase is already in progress.')
next
......
......@@ -28835,6 +28835,9 @@ msgstr ""
msgid "This means you can not push code until you create an empty repository or import existing one."
msgstr ""
msgid "This merge request cannot be rebased while there are conflicts."
msgstr ""
msgid "This merge request does not have accessibility reports"
msgstr ""
......
......@@ -63,6 +63,16 @@ RSpec.shared_examples 'rebase quick action' do
expect(page).not_to have_content 'Scheduled a rebase'
end
end
context 'when there are conflicts in the merge request' do
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project, source_branch: 'conflict-missing-side', target_branch: 'conflict-start', merge_status: :cannot_be_merged) }
it 'does not rebase the MR' do
add_note("/rebase")
expect(page).to have_content 'This merge request cannot be rebased while there are conflicts.'
end
end
end
context 'when the current user cannot rebase the MR' do
......
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