Skip to content

Fix notify_conflict? raising exception due to absent branches

Mark Chao requested to merge 48653-mr-target-branch-missing into master

What does this MR do?

Fix 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?

What are the relevant issue numbers?

Closes #48653 (closed)

Edited by Mark Chao

Merge request reports

Loading