Skip to content

Fix Branch Rules showing 'All protected branches' under 'All branches'

Joe Woodward requested to merge fix/branch_rules_all_branches_scope into master

What does this MR do and why?

Fix Branch Rules showing 'All protected branches' under 'All branches'

The scope ApprovalProjectRule::for_all_branches returns branches which don't have ProtectedBranch associations.

However, the ApprovalProjectRule::for_all_protected_branches scope filters this further for applies_to_all_protected_branches: true.

This means the for_all_branches scope is also returning the rules for all_protected_branches.

This change modifies the for_all_branches scope so it only returns records where applies_to_all_protected_branches: false.

Closes #428946 (closed)

Changelog: fixed

Screenshots

image

image

image

image

How to set up and validate locally

  1. Create/visit a project
  2. In the Merge Request settings configure an approval rule to apply to all protected branches
  3. Go to the Repository settings and view the Branch rules
  4. Observe that the rule is shown in both sections

Merge request reports