gitkraken / vscode-gitlens

Supercharge Git inside VS Code and unlock untapped knowledge within each repository — Visualize code authorship at a glance via Git blame annotations and CodeLens, seamlessly navigate and explore Git repositories, gain valuable insights via rich visualizations and powerful comparison commands, and so much more
http://gitkraken.com/gitlens
Other
9.03k stars 1.35k forks source link

Link to the wrong URL #2701

Open SEWeiTung opened 1 year ago

SEWeiTung commented 1 year ago

Description

Steps to reproduce this bug:

  1. Open any repository based on Git in the latest VS code.

  2. Move your mouse onto a branch's PR: image

  3. Notice there are many link IDs like "#5166", and the yellow-circled part will raise a bug if you click it and open a page, a 404 page will be shown.

Reason

Compare the two links you'll see:

1) For the right one, the URL should be something like this:

https://github.com/The ORIGINAL owner name/The repository name/pull/5166

2) For the wrong one, the URL:

https://github.com/The CURRENT owner name/The repository name/pull/5166

Solution

To fix the URL's owner name (just as the other #5166 in the image, they are right in URL).

GitLens Version

13.6.0

VS Code Version

Version: 1.78.2 (system setup) Last PR: b3e4e68a0bc097f0ae7907b217c1119af9e03435 Date: 2023-05-10T14:39:26.248Z Electron: 22.5.2 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19045 Is Sand-boxed: Yes

Git Version

2.34.0.windows.1

Logs, Screenshots, Screen Captures, etc

No response

jkelroy commented 1 year ago

Hello @MaledongGit, can you please expand on this issue you are seeing? By "ORIGINAL" and "CURRENT" do you mean that the name of the GitHub user who owns the repository has been changed? Or is this a pull request to/from a fork and an upstream/original repository?

SEWeiTung commented 1 year ago

Hello @MaledongGit, can you please expand on this issue you are seeing? By "ORIGINAL" and "CURRENT" do you mean that the name of the GitHub user who owns the repository has been changed? Or is this a pull request to/from a fork and an upstream/original repository?

"ORIGINAL" here means "The original source name of the repository", "CURRENT" means the cloned (Forked) name of the repository.

e.g: Suppose I forked Nodejs.org and name it as "MaledongNode". The "ORIGINAL" name is "Nodejs", and "Current" name is "MaledongNode".

So the bug actually means:

When I submit a PR to Nodejs.org and it gets merged, and when I see it in the GitLens by clicking the PR in the GitLens windows, it opens up a 404 page instead of a real one.

image

As what you can see in the image, you can have a play with it directly in the latest version of VS and Git:

  1. Open the VS.
  2. Expand some repository in VS.
  3. Move your mouse on a certain PR (Just what u see in the image).
  4. A Dialog will pop up, just click "#ID" parts (please compare, there's always something wrong with the one inside "()", as the yellow part). The URL is diff.
eamodio commented 1 year ago

This is caused because of the difference between autolinks (what you have highlighted in yellow above) and the enrichment from the rich GitHub integration. Autolinks are "dumb" mappings, while the integration has context and can tell if the PR is from a fork.

We'll have to look into seeing if we can override the autolinks when they match with a connected remote.

In the meantime you should be able to workaround the issue, by setting the "true" repo as the "default" remote in GitLens -- e.g. right-click on the remote in the Remotes view and choose "Set as Default"

Hope that helps!

SEWeiTung commented 1 year ago

In the meantime you should be able to workaround the issue, by setting the "true" repo as the "default" remote in GitLens -- e.g. right-click on the remote in the Remotes view and choose "Set as Default"

Do u mean I should set "Default" to the original remote repo? I did it but no helps :(

But still say "Thank you" to @eamodio and @jkelroy :)

mingzheTerapines commented 2 months ago

Same problem, if I forked a project and opened RP/issue link, it will go to my forked website's sub website.