Fix NoMethodError from Projects::CompareController#show

What does this MR do and why?

Sentry error: https://new-sentry.gitlab.net/organizations/gitlab/issues/1790363

Problem

NoMethodError: undefined method `diff_refs' for
nil:NilClass (NoMethodError)

        send_git_diff source_project.repository, compare.diff_refs
                                                        ^^^^^^^^^^

The validation for presence of compare results is missing for patch and diff formats.

Solution

Return 404 error when compare results are not available.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading