"Create branch" from "Issue" misnames branch and sets wrong merge target branch if slash "/" is present in branch names
Summary
- Creating a branch from an issue does not work if "/" is present in branch name
- Creating a merge request from an issue does not target correct "source" branch if "/" is present in branch name
Steps to reproduce
- Open "Issues" in sidebar for a project
- Locate an existing issue or create one from scratch
- Click on disclosure arrow next to "Create merge request"
- Choose "Create merge request and branch"
- Type in a new branch name containing a slash, like "ABC/XYZ"
- Choose a source branch name containing a slash, like "release/1.0.0"
- Click on "Create merge request button"
- Merge request and branch will be created
- Branch name is the default suggested branch name instead of the one typed in
- The "merge target" is also the default suggested branch ("master" or "main") instead of the one selected
Example Project
N/A
What is the current bug behavior?
- Branch name created is always the "default suggested" name based on the ticket name rather than the one the user typed, if the branch name has a slash in the name.
- Merge target is always the "default" target branch (usually this is "master" or "main") if the merge target has a slash in the name.
What is the expected correct behavior?
- Branch names for new branches should be respected if they have a slash in them.
- Branch names for "source branches" (merge targets) should also be respected if they have a slash in them.
- Branch and merge request creation should not proceed if for some reason Gitlab cannot properly create the branch or find the merge target. (In other words, don't just create default branch names or set default merge targets if input validation fails for some reason.)
Relevant logs and/or screenshots
Note that we've chosen TJG/SG-2 as the branch name and release/1.0.0 as the branch target.
Note that that the branch name is 1-create-swift…etc and the merge target is now master, both of which are incorrect.
Output of checks
N/A
Results of GitLab environment info
GitLab Community Edition 13.7.4
Results of GitLab application Check
N/A
Possible fixes
N/A

