Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request links in blame tooltip do not respect forks #22277

Closed
1 task done
AaronFeickert opened this issue Dec 20, 2024 · 3 comments
Closed
1 task done

Pull request links in blame tooltip do not respect forks #22277

AaronFeickert opened this issue Dec 20, 2024 · 3 comments
Labels
bug [core label] git blame git Git integration feedback

Comments

@AaronFeickert
Copy link
Contributor

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

It's possible to directly link to a pull request from the blame tooltip. However, this link is invalid if the repository is a fork, which is a very common workflow.

In this case, the provided link might be of the form github.com/ForkOwner/repository/pulls/1. However, the actual pull request link should reference the upstream repository and be of the form github.com/UpstreamOwner/repository/pulls/1.

Zed Version and System Specs

Zed: v0.166.1 (Zed)
OS: macOS 15.2.0
Memory: 16 GiB
Architecture: aarch64

If applicable, add screenshots or screencasts of the incorrect state / behavior

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

@AaronFeickert AaronFeickert changed the title Pull request links in blame tooltip does not respect forks Pull request links in blame tooltip do not respect forks Dec 20, 2024
@AaronFeickert
Copy link
Contributor Author

AaronFeickert commented Dec 20, 2024

The current version of the GitHub API can provide this functionality directly. This seems much more robust than trying to construct a pull request URL manually using pieced-together data from the repository and commit messages.

@AaronFeickert
Copy link
Contributor Author

AaronFeickert commented Dec 20, 2024

On further thought, it isn't clear how to take advantage of the relevant API in an efficient way. Making an API call to get the pull request associated to every commit from a file's blame seems excessive, and could hit usage limits pretty quickly. Another option would be to make the call for an individual line's blame commit on demand, but this could slow down the UX.

A simpler initial fix could be to use the API instead to get the repository's parent (if applicable) and use this to build pull request URLs. This isn't foolproof, since it could be the case that the pull request is not against the parent. However, it seems like this approach would be objectively more reliable than the current behavior.

@JosephTLyons
Copy link
Collaborator

Since #25044 has been added to our Quality Week board and @Anthony-Eid is working on it, I'm going to close this issue out. Check out 25044 for updates on the bug fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] git blame git Git integration feedback
Projects
None yet
Development

No branches or pull requests

2 participants