Web IDE fix commit after first commit on empty repo
(Follow up from !25463 (merged))
Problem
"Commit to master" AND "Start a new MR" are both selected on repetitive commits to a new repo.
How to reproduce
- Use the Web IDE on an empty repo by going straight to the Web IDE URL for the empty project
- e.g.
https://gitlab.com/-/ide/project/gitlab-org/<empty project>/edit/master/-/
- e.g.
- Create a file, type something in it and commit (creates the first commit)
- Make new changes to the file
- Go to "Commit" view
- "Commit to master" AND "Start a new MR" are both selected (which is wrong and "Start a new MR" shouldn't be selected/shown at all unless "Create a new branch" option is selected):
- After clicking the "Commit" button, the user is sent to a "New Merge Request" screen with
merge_request[target_branch]=null
in the URL and visible error message:
http://127.0.0.1:3000/root/empty-test-4/-/merge_requests/new?merge_request[source_branch]=master&merge_request[target_branch]=null&nav_source=webide
Kapture_2020-05-26_at_12.53.28
Expected behavior
"Start a new merge request" option is not available when "Commit to master
branch" option is selected.
master
branch option
Original issue with crossed Description
When using the Web IDE on an empty repo, the user is brought back to the file tree. If they make more changes (without refreshing the page) and go to commit, the commit to master
will be crossed out (even though they just committed to master
):
Expected behavior
The Commit to master branch
option should not be crossed out since this is an available action for me.
Analysis
Part of this is because our state tree does not have a SSOT for "canPushToCurrentBranch" and "isOnDefaultBranch".
Edited by Denys Mishunov