Incorrect branch name when 'Create Branch/MR' from issue if Source branch is not default
Summary
When creating a new branch using Create merge request
or Create merge request and branch
(from an issue), and a user changes the default branch name AND the source branch name, the new branch is created with the incorrect name and the UI doesn't indicate the branch was created and the user remains on the issue page.
This is confusing for the user, as when the user goes to create the branch again, an error will occur as the default branch name will be used again to create the branch.
More details in comment: #23626 (comment 1087555396)
Steps to reproduce
Could be reproduced today (2018, Aug 8th) on gitlab.com using the following steps:
- Create a new project
- Create a new branch named 'DEV' from master (Repository > Branches > New Branch)
- Create a new issue (Issues > New Issue)
- Create a merge request from issue (Create merge request)
- Change branch name to 'ISSUE_CustomName'
- Change Source branch to 'DEV'
- Click 'Create merge request' The new branch is created with default name (1-issue-01), which is not the expected behavior.
I have also noticed that the behavior is correct if the Source branch is the default branch of the project. if the Source branch is the default branch of the project, the branch created with the merge request will have the name provided by the user.
NOTE: This occurs for the Create merge request and branch
and Create branch
options from the issue interface.
Additional steps to reproduce and videos of this issue can be found in this duplicate: #343431 (comment 1095022240)
Example Project
I have recorded a video, using the project: https://gitlab.com/boninm/Test_MR_BranchName
What is the current bug behavior?
The new branch is created with default name (1-issue-01) and not the branch name provided in the user interface.
What is the expected correct behavior?
The new branch should be created using the name provided by user.
Relevant logs and/or screenshots
I have uploaded a video to show the problem. Project
Output of checks
This bug happens on GitLab.com