Skip to content

Don't rebase when the branch protected from force push

Vasilii Iakliushin requested to merge notify_about_force_push_before_rebase into master

What does this MR do and why?

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

Screenshot_2022-02-09_at_21.38.12

How to set up and validate locally

  1. Create a merge request targeting default branch
  2. Push new commits to default branch
  3. Add merge request branch to Protected branches list (Settings -> Repository -> Protected branches)
  4. Make sure that Allow force push option is disabled
  5. Open merge request page
  6. Post a comment with a quick command /rebase
  7. 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.

Merge request reports

Loading