sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.28k forks source link

"View file prior to this change" link takes to the "File not found" page #47558

Closed taras-yemets closed 4 months ago

taras-yemets commented 1 year ago

The "View blame prior to this change" link in the git blame popover doesn't work if the file has been added or renamed in the current revision because we assume it had the same name in the previous one.

screenshot_2023-02-11_08 34 46

Steps to reproduce:

  1. On your Sourcegraph instance, open a file and turn on the blame decorations.
  2. Hover over the decoration which "View file prior this change" link points to a revision in which this file didn't exist or was named differently (e.g. cmd/gitserver/server/vcs_syncer_git.go?L117:6).
  3. Click "View file prior this change" link.

Expected behavior:

The link is inactive or not rendered at all if the file didn't exist (with this name) in the previous revision.

Actual behavior:

The link takes us to the "File not found page".

If you would like immediate help on this, please email support@sourcegraph.com (you can still create the issue, but there are no SLAs on issues like there are for support requests).

taras-yemets commented 1 year ago

As a workaround, we can check whether the file exists in the requested revision either when the blame popover is rendered or when the “View blame prior to this change” link is clicked: intercept => loading => “file doesn’t exist” message or navigate to URL (similar to what we do when Cmd+Click on occurrence to go to definition).

Screenshot 2023-02-13 at 17 11 38 Screenshot 2023-02-13 at 17 10 31
pjlast commented 6 months ago

Closing since we're tracking this here: https://github.com/sourcegraph/sourcegraph/issues/60159

With a fix inbound.

fkling commented 4 months ago

It seems we are not rendering the link anymore.