Don't rebase when the branch protected from force push
What does this MR do and why?
- Contributes to #351520 (closed)
- Sentry error: https://sentry.gitlab.net/gitlab/gitlabcom/issues/3091321
Problem
Merge request rebase action does not verify whether the source branch is protected from the force push.
Solution
- Verify if the branch permits force push
- Show notification when the user tries to rebase this branch
Screenshots or screen recordings
How to set up and validate locally
- Create a merge request targeting default branch
- Push new commits to default branch
- Add merge request branch to Protected branches list (Settings -> Repository -> Protected branches)
- Make sure that
Allow force push
option is disabled - Open merge request page
- Post a comment with a quick command
/rebase
- Verify that the force push notification appeared
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.