Misleading branch state of "merged" when branch is behind and has zero changes
Summary
A branch with no changes and is one or more changes behind the originating branch will have the label merged
displayed for the state of the branch.
This issue is a severity1 because of the following reasons:
- it is not clear to the user why this is happening
- they may try to clear the status by pressing "Delete merged branches"
- These branches with no changes would not get deleted because it was not really merged
- Real merged branches could be deleted by accident
- They could reach out to support to ask why
merged
branches appear when no changes were ever made.
I can't figure this out." Users are blocked and/or likely to make risky errors due to poor usability, and are likely to ask for support.
Steps to reproduce
- Go to an issue
- Create a new merge request by using the button "Create merge request"
- Once the merge request and branch is created, go back to the originating branch and make a change
- Now the new branch should be 1 change behind the originating branch
- The
merged
label should appear when you go toRepository > Branches
What is the current bug behavior?
A merged
label appears for the newly created branch.
Relevant logs and/or screenshots
What is the expected correct behavior?
No merged
label is displayed
Display the correct state of the merge request rather than using the diff count.
Possible fixes
Update the check for branch state of merged
to not only look at changes count of 0.
- Use a badge to display state of merge request when state is
Open
orMerged
- Clicking on the badge navigates the user to the merge request
- The label of the badge is the merge request id formatted like
!12345
- Badge size
md
- Badge variant
-
Open
= Info -
Merged
= Success
-
On hover, we should reuse the popover that we use for displaying information about merge requests in descriptions and comments. The purpose of this is to explain what the icon and color of the badge means.
- Information in popover
- Merge request status
- Merge request created date
- Merge request title
- Merge request link and link text
- Pipeline status