Skip to content

Add push option to select target project for MR

What does this MR do and why?

This merge request addresses #342985 (closed) by adding the merge_request.target_project push option so users can select the target project when creating a merge request, all with the vanilla Git client.

Screenshots or screen recordings

None provided

How to set up and validate locally

  1. Create project; we'll call this the base project.
  2. Fork base project into what we'll call the intermediate project.
  3. Fork intermediate project into what we'll call the leaf project.
  4. Clone the leaf project (as "origin") onto a system with git clone.
  5. Checkout a new branch and commit changes to it.
  6. Run git push -f -o merge_request.create origin HEAD; notice how the created MR is to the intermediate project.
  7. Run git commit --amend --no-edit so the next push will actually occur (make sure at least 1 second has occurred since last commit).
  8. Run git push -f -o merge_request.create -o merge_request.target_project=<gitlab-path/to/base-project> origin HEAD; notice how the MR is to the base project.
  9. Run git commit --amend --no-edit.
  10. Run git push -f -o merge_request.create -o merge_request.target_project=DOES-NOT-EXIST origin HEAD; notice error.
  11. Run git commit --amend --no-edit.
  12. Run git push -f -o merge_request.create -o merge_request.target_project=<unrelated-project> origin HEAD; notice error.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports