Error 500 when rendering diffs from forks

This is likely a regression caused by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10602. It looks like the helper is not being passed a path when the diff controller is in use.

We are reverting this from 9.1 RC6. I'm not quite sure why that MR was labeled with ~"Pick into Stable".

https://sentry.gitlap.com/gitlab/gitlabcom/issues/28035/

TypeError: no implicit conversion of nil into String
  app/helpers/tree_helper.rb:34:in `join'
    File.join(*args)
  app/helpers/tree_helper.rb:34:in `tree_join'
    File.join(*args)
  app/helpers/blob_helper.rb:13:in `edit_path'
    tree_join(ref, path),
  app/helpers/blob_helper.rb:32:in `edit_blob_link'
    to: edit_path,
  app/views/projects/diffs/_file.html.haml:15:in `_app_views_projects_diffs__file_html_haml___1121649036413133914_70307416411280'
    = edit_blob_link(@merge_request.source_project, @merge_request.source_branch, diff_file.new_path,
...
(159 additional frame(s) were not displayed)

ActionView::Template::Error: no implicit conversion of nil into String

ActionView::Template::Error: no implicit conversion of nil into String

To reproduce this problem:

  1. Fork project gitlab-org/gitlab-ce (or any project)
  2. Submit a MR from your fork to the main project
  3. Sign in as a different user who does NOT have access to that fork
  4. View the MR