[go: up one dir, main page]

Skip to content

Gitlab switches target branch by itself after clicking on Compare button inside my working branch

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Gitlab switches target branch by itself after clicking on Compare button inside my working branch

Steps to reproduce

  1. Go to Project / Repository
  2. Use ref selector to switch to a non default branch
  3. From the More actions dropdown select Compare
  4. You're redirected to Compare revisions page. Create merge request is already visible and pre-populated with the selected branch and the default branch.
  5. Under Target section change the branch name.

What is the current bug behavior?

Changing the branch name for the target does not update the href attribute of the Create merge request button. It only happens after clicking Compare. As a result, the MR is created for a previous selection of the source/target pair.

What is the expected correct behavior?

Create merge request button reflects the lates selection of the source/target pair on Compare revisions page and correctly handles scenarios for already opened MR or no possibility to open an MR.

Current behaviour is slightly different to the regular experience of the Compare revisions page, when the button only appears after user clicks Compare first. This helps preventing some edge case scenarios like:

  • creating an MR against a tag
  • creating an MR for a set of branches that already exists (in which case the button directs to already open MRs).

➡️ We should hide Create merge request button on the page entry and only render it after the user triggers Compare button.

Relevant logs and/or screenshots

image image

Desktop_2025.04.25_-_16.54.19.01

Edited by 🤖 GitLab Bot 🤖