Creating a merge request from the default branch of a fork to an upstream project using push options doesn't work
Creating merge requests from a fork to the upstream project does not work if the branch name is the same as the default branch in the upstream project.
I think this is caused by this block in MergeRequests::PushOptionsHandlerService#get_branches
I believe we should only skip this branch if target_project == project
.
The following discussion from !20639 (merged) should be addressed:
-
@oswaldo started a discussion: (+2 comments) @reprazent I see a few edge cases where we couldn't reach the
newrev
:next unless Gitlab::Git.branch_ref?(changes[:ref]) # Deleted branch next if Gitlab::Git.blank_ref?(changes[:newrev]) # Default branch branch_name = Gitlab::Git.branch_name(changes[:ref]) next if branch_name == target_project.default_branch
Should we do a
changes_by_branch.dig(branch, :newrev)
here instead? Furthermore, wouldn't we get anil
SHA if we point to the default branch from the get going, or am I misinterpreting this call?