Skip to content

Fix `prevent_pushing_and_force_pushing` UI controls

What does this MR do and why?

Fixes a UI bug caused by prevent_pushing_and_force_pushing not getting pattern-matched correctly.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  • Create a new group and a contained project

  • On the project level:

    • Navigate to Settings > Repository and create the following branch protections:
      • develop
      • foo*
      • test-123
      • unrelated
  • On the group level:

    • Navigate to Security > Policies and create the following MR approval policy:
type: approval_policy
name: Block protected branches
enabled: true
rules:
  - type: any_merge_request
    branches:
      - test-*
    commits: any
  - type: any_merge_request
    branches:
      - develop
    commits: any
  - type: any_merge_request
    branches:
      - foo*
    commits: any
  - type: any_merge_request
    branch_type: protected
    commits: any
actions:
  - type: require_approval
    approvals_required: 1
    role_approvers:
      - owner
approval_settings:
  block_branch_modification: true
  prevent_pushing_and_force_pushing: true
  • On the project level, navigate to Settings > Repository and verify that the Allowed to push and merge dropdowns are disabled except for unrelated.

Related to #456499 (closed)

Edited by Dominic Bauer

Merge request reports