Fallback to start commit when merge base is missing
What does this MR do and why?
Contributes to #407552 (closed)
Problem
When two branches don't have a common merge base Compare API returns a 500 error.
Solution
Fallback to start commit when the common merge base is missing.
How to set up and validate locally
- Clone https://gitlab.com/vyaklushin/compare-diverged-test
- Visit compare page: https://gitlab.com/vyaklushin/compare-diverged-test/-/compare/diverge...master?from_project_id=45262106&straight=false
- Visit compare API (on GitLab.com raises 500 error): https://gitlab.com/api/v4/projects/45262106/repository/compare?from=diverge&to=master
- After the fix, the API response should be rendered and match compare page results.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vasilii Iakliushin