Cannot create merge request across forks
Steps to reproduce
-
Create a repository repo in a group group
-
User A forks group/repo to A/repo
-
User B forks group/repo to B/repo
-
User B creates branch B/repo:source, and submits a merge request group/repo!###
-
User A checks out branch B/repo:source and adds a commit to it which is pushed to A/repo:source
-
User A clicks to create a merge request from A/repo:source
-
User A clicks Change branches, to specify B/repo:source as the target of the new merge request
📝 B/repo will not appear in the list of available targets, but if you explicitly set thetarget_project_id
to the project ID of B/repo, it will allow you to proceed. -
Click Compare branches and continue
-
Click Submit merge request
Actual results
-
In step 7, B/repo is not listed as an available target for the merge request
-
After step 8, the target branch incorrectly shows the branch name without a repository:
-
After step 9, an error is shown and the merge request does not succeed:
The form contains the following error:
- Validate fork Source project is not a fork of target project
Expected results
- Provided User A can see B/repo and merge requests are enabled there, User A should have seen B/repo as an available target for the merge request
- After step 8, the target branch should have read B/repo:source instead of just source
- After step 9, no error should have been reported and the merge request should be created at B/repo!###
Impact
During code reviews, it is often easier to check out a branch an propose a change in the form of code. Rather than write a bunch of comments explaining the proposed change, a merge request allows the reviewer to propose changes to the original merge request that are then accepted by the original merge request's author. After accepting the update, the original merge request is automatically updated to include the work from the original author and the changes from the reviewer.
This is a common practice which is expected to work seamlessly when using a forking workflow. Currently GitLab only allows this practice to be used with a branching workflow (and no forks).