Fix notify_conflict? raising exception due to absent branches
What does this MR do?
notify_conflict? raising exception when branches do not exist.
repository.can_be_merged? can raise error if
diff_head_sha(source branch) or
target_branch are absent, therefore before we call
repository.can_be_merged?, we want to check for presence of target/source branch.
So we check for other unmergeable reasons first, and only call
repository.can_be_merged? if it is not due to branch missing or no-commits.
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
notify_conflict? is called when merge request becomes unmergeable. However unmergeability can be caused due to target or source branch being missing, and in this case we want to avoid caling the underlying
repository.can_be_merged? method as it will raise error, which is undesirable.
Does this MR meet the acceptance criteria?
- Changelog entry added, if necessary
- Documentation created/updated
- API support added
- Tests added for this feature/bug
- Conform by the code review guidelines
- Has been reviewed by a UX Designer
- Has been reviewed by a Frontend maintainer
- Has been reviewed by a Backend maintainer
- Has been reviewed by a Database specialist
- Conform by the merge request performance guides
- Conform by the style guides
- If you have multiple commits, please combine them into a few logically organized commits by squashing them
- Internationalization required/considered
End-to-end tests pass (
package-and-qamanual pipeline job)
What are the relevant issue numbers?
Closes #48653 (closed)