How is GitLab checking if a merge request can be merged without conflicts?

I’ve been trying to figure out how GitLab is checking if a merge request can be merged without conflict and activate the merge button or deactivate it on merge conflict.

I stumbled over Gitaly but couldn’t find the exact spot on where the check is made. Could somebody please introduce the lines of code to me where this happens? I need these lines of code for another project I’m working on.

Thank you for your help!

This is the entry-point to the Gitaly request that is used to check a mergeable status (if anything is returned, it is considered as cannot merge): internal/gitaly/service/conflicts/list_conflict_files.go · master · GitLab.org / gitaly · GitLab