Skip to content

Fix merge request 500 when first commit does not have a parent

Fixes gitlab-org/gitlab-ce#19384

Under some strange circumstances, a merge request may contain a first commit that has no parent. In this case the merge request widget may fail when trying to find the source_sha_parent. This merge request adds a simple check to see if there are any parents before calling first.sha on the commit.

Things to check

I didn't write any tests for this. I'm not 100% sure of the best way to create a commit in the merge request that has no parents.

@dbalexandre Do you mind doing a review, please? Maybe you have some ideas on writing a test?

Merge request reports