Fix creation of merge requests for orphaned branches with images
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)