Protected Branches wildcard allows white-spaces, leading to misconfiguration
Summary
In a Project's repository settings, an option to protect branches is given. This option allows to create different wildcards, but if you add a white-spaces, it creates different wildcards. This is a problem especially when adding a white-space to the end or the start of the wildcard, as it's not visible in the UI.
Steps to reproduce
- Create a Project with some content(e.g. README file)
- Navigate to Settings -> Repository -> Protected Branches
- Protect branch "test* "(notice the white-space here) and also protect branch "test*".
- Create a new branch test1, you'll see that it only appears in "test*"(without whitespace) protection.
Git doesn't allow to create branches with white-spaces, so it would fail to test to create "test1 ".
Example Project
Here is a test project: https://gitlab.com/main_group1/test-proj
What is the current bug behavior?
White-spaces are permitted in Protected branch creation and are not visible in the UI after creation.
What is the expected correct behavior?
White-spaces should not be permitted in Protected branch creation as git doesn't support creating branches with whitespaces.
Relevant logs and/or screenshots
Protected branches, first test* contains no whitespaces, second test* contains one whitespace on creation. The matching branch is "testthis":
Output of checks
This bug happens in Gitlab.com.
Possible fixes
Strip white-spaces or show an error message, similar to branch creation when creating a Protected branch wildcard with white-spaces.