Prevent creating a MR on a non-existing branch using API
Problem to solve
Creating a MR from an existing branch to a non-existing branch proceeds successfully in the CLI, while the web interface displays an error message.
Proposal
Check whether the MR's target branch exists on the project's repository, and prevent users from creating merge requests on non-existing branches.
Further details
This issue is loosely related to cli#979
➜ glab-mr-to-non-existing-branch git:(main) glab mr create -b develop
? Choose a template Open a blank merge request
? Title: this is a test
? Description <Received>
? What's next? Submit
Creating merge request for main into develop in william-atyos/glab-mr-to-non-existing-branch
!1 this is a test (main)
https://gitlab.com/william-atyos/glab-mr-to-non-existing-branch/-/merge_requests/1
glab version : glab version 1.34.0 (2023-10-21)
Links / references
See this MR for reference : william-atyos/glab-mr-to-non-existing-branch!1
Edited by William Schmitt