Fix creation of merge requests for orphaned branches with images

Stan Hu requested to merge stanhu/gitlab-ce:fix-mr-for-orphaned-branches into master

When attempting to create a merge request from an orphaned branch (e.g. this happens for the first commit of any repo) that contained images, GitLab would fail with a Error 500. This MR fixes that problem.

Closes #14875 (closed)

Merge request reports