Add pull requests to git blame tooltip (#10784)

Release Notes:

- Added links to GitHub pull requests to the git blame tooltips, if they
are available.

Screenshot:

(Yes, the icon will be resized! cc @iamnbutler)

![screenshot-2024-04-19-18 31
13@2x](https://github.com/zed-industries/zed/assets/1185253/774af0b3-f587-4acc-aa1e-1846c2bec127)
This commit is contained in:
Thorsten Ball 2024-04-19 18:54:20 +02:00 committed by GitHub
parent 70427daed2
commit f082344747
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 145 additions and 20 deletions

View file

@ -6,6 +6,7 @@ use git::{
blame::{Blame, BlameEntry},
hosting_provider::HostingProvider,
permalink::{build_commit_permalink, parse_git_remote_url},
pull_request::{extract_pull_request, PullRequest},
Oid,
};
use gpui::{Model, ModelContext, Subscription, Task};
@ -75,6 +76,7 @@ pub struct CommitDetails {
pub message: String,
pub parsed_message: ParsedMarkdown,
pub permalink: Option<Url>,
pub pull_request: Option<PullRequest>,
pub remote: Option<GitRemote>,
}
@ -438,6 +440,10 @@ async fn parse_commit_messages(
repo: remote.repo.to_string(),
});
let pull_request = parsed_remote_url
.as_ref()
.and_then(|remote| extract_pull_request(remote, &message));
commit_details.insert(
oid,
CommitDetails {
@ -445,6 +451,7 @@ async fn parse_commit_messages(
parsed_message,
permalink,
remote,
pull_request,
},
);
}