Protected branches preview shows too many branches when using a wildcard pattern

Summary

When using an infix wildcard pattern for protected branches, the protected branch preview shows branches that don't seem to be protected

For example, when you have the branches 7.3.x and 7.3.x-patch in your project, and use the 7.*.x wildcard to protect your branches

  • the main page says only one branch is protected (which I assume is the 7.3.x branch) image
  • the 'show matching branches' page also includes the 7.3.x-patch branch image

Steps to reproduce

  • Have a repository with branches 7.3.x and 7.3.x-patch
  • Open the repository settings and add the 7.*.x wildcard pattern for protected branches
  • Notice the difference in the counted 'protected branches' and the list of protected branches when you click through on that count

Example Project

https://gitlab.com/willem.verstraeten/protected-branches-reproduction/-/protected_branches/187188217

What is the current bug behavior?

The list of protected branches does not match the summary count of protected branches

What is the expected correct behavior?

The count and the list should match

Relevant logs and/or screenshots

  • the main page says only one branch is protected (which I assume is the 7.3.x branch) image
  • the 'show matching branches' page also includes the 7.3.x-patch branch image

Output of checks

This bug happens on GitLab.com as well as on our on-prem instance (version 18.6).

Results of GitLab environment info

image

Edited by 🤖 GitLab Bot 🤖