Skip to content

Fix MRTarget equality to compare branch values - #3175

Merged
centosinfra-prod-github-app[bot] merged 1 commit into
packit:mainfrom
rgetz:rgetz-fix-MRTarget
Sep 10, 2026
Merged

Fix MRTarget equality to compare branch values#3175
centosinfra-prod-github-app[bot] merged 1 commit into
packit:mainfrom
rgetz:rgetz-fix-MRTarget

Conversation

@rgetz

@rgetz rgetz commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

As described in #3173

MRTarget.__eq__() compared self.branch with itself instead of comparing it with other.branch, causing targets with the same repository but different branches to compare as equal.

Correct the comparison and add a regression test verifying that gitlab_mr_targets_handled membership respects the configured branch.

This ensures GitLab MR target matching does not incorrectly treat different branch patterns as the same target.

The MRTarget.__eq__() issue being corrected here has been present since the original implementation was introduced in 2021. It was noticed during a review of the code rather than as the result of a reported bug or observed production failure.

This correction aligns MRTarget equality with the behavior described by the original commit message: both the repository and branch are part of the target definition.

No specific production issue or crash has been attributed to this issue.

@rgetz
rgetz requested a review from a team as a code owner August 26, 2026 23:42
@rgetz
rgetz requested review from nforro and removed request for a team August 26, 2026 23:42
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@rgetz
rgetz force-pushed the rgetz-fix-MRTarget branch from 9e04f44 to 38af0cc Compare August 26, 2026 23:47
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@rgetz
rgetz force-pushed the rgetz-fix-MRTarget branch from 38af0cc to af40dad Compare August 31, 2026 23:26
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@betulependule betulependule left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you 🙏

MRTarget.__eq__() compared self.branch with itself instead of comparing
it with other.branch, causing targets with the same repository but
different branches to compare as equal.

Correct the comparison and add a regression test verifying that
gitlab_mr_targets_handled membership respects the configured branch.

This ensures GitLab MR target matching does not incorrectly treat
different branch patterns as the same target.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@betulependule betulependule added the mergeit Merge via Zuul label Sep 10, 2026
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@centosinfra-prod-github-app
centosinfra-prod-github-app Bot merged commit c1f0191 into packit:main Sep 10, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in Packit pull requests Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mergeit Merge via Zuul

Projects

Development

Successfully merging this pull request may close these issues.

3 participants