Permalink to collapsed diff line does not work

Summary

If you open a permalink to a collapsed diff, the diff is not expanded automatically, so the link doesn't work.

Steps to reproduce

  1. Create a large commit with collapsed diffs.
  2. Uncollapse a diff.
  3. Click on a line number in an uncollapsed diff.
  4. Copy the url from the address bar.
  5. Paste the url into a new window.

Expected behavior

The commit is shown with the diff containing the selected line uncollapsed, and the browser scrolls to that line.

Actual behaviour

The commit is opened with the diff containing the selected line collapsed, so the browser can't scroll to that line. It's impossible to find out which line the link pointed to.

Relevant logs and/or screenshots

Example link: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/commit/eccc4ee97c6d6a2a52326870e1b6710320e65148#b95f3f1649c22b152682c492065b3466ab0949a5_8_4

This should link to Godeps.json's new line 4.