diff --git a/Cargo.lock b/Cargo.lock index 051ffa281a..07203de787 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4458,7 +4458,6 @@ dependencies = [ "env_logger 0.11.6", "feature_flags", "fs", - "git", "gpui", "http_client", "language", diff --git a/crates/collab/src/tests/editor_tests.rs b/crates/collab/src/tests/editor_tests.rs index 1bc0813e39..30b8f7d8aa 100644 --- a/crates/collab/src/tests/editor_tests.rs +++ b/crates/collab/src/tests/editor_tests.rs @@ -3,7 +3,6 @@ use crate::{ tests::{rust_lang, TestServer}, }; use call::ActiveCall; -use collections::HashMap; use editor::{ actions::{ ConfirmCodeAction, ConfirmCompletion, ConfirmRename, ContextMenuFirst, Redo, Rename, @@ -1983,7 +1982,6 @@ async fn test_git_blame_is_forwarded(cx_a: &mut TestAppContext, cx_b: &mut TestA blame_entry("3a3a3a", 2..3), blame_entry("4c4c4c", 3..4), ], - permalinks: HashMap::default(), // This field is deprecrated messages: [ ("1b1b1b", "message for idx-0"), ("0d0d0d", "message for idx-1"), diff --git a/crates/editor/src/git/blame.rs b/crates/editor/src/git/blame.rs index 5868133642..c3b76a651d 100644 --- a/crates/editor/src/git/blame.rs +++ b/crates/editor/src/git/blame.rs @@ -370,7 +370,6 @@ impl GitBlame { async move { let Some(Blame { entries, - permalinks, messages, remote_url, }) = blame.await? @@ -379,13 +378,8 @@ impl GitBlame { }; let entries = build_blame_entry_sum_tree(entries, snapshot.max_point().row); - let commit_details = parse_commit_messages( - messages, - remote_url, - &permalinks, - provider_registry, - ) - .await; + let commit_details = + parse_commit_messages(messages, remote_url, provider_registry).await; anyhow::Ok(Some((entries, commit_details))) } @@ -477,7 +471,6 @@ fn build_blame_entry_sum_tree(entries: Vec, max_row: u32) -> SumTree async fn parse_commit_messages( messages: impl IntoIterator, remote_url: Option, - deprecated_permalinks: &HashMap, provider_registry: Arc, ) -> HashMap { let mut commit_details = HashMap::default(); @@ -495,11 +488,7 @@ async fn parse_commit_messages( }, )) } else { - // DEPRECATED (18 Apr 24): Sending permalinks over the wire is deprecated. Clients - // now do the parsing. This is here for backwards compatibility, so that - // when an old peer sends a client no `parsed_remote_url` but `deprecated_permalinks`, - // we fall back to that. - deprecated_permalinks.get(&oid).cloned() + continue; }; let remote = parsed_remote_url diff --git a/crates/evals/Cargo.toml b/crates/evals/Cargo.toml index 6484e9a6a7..9661da04eb 100644 --- a/crates/evals/Cargo.toml +++ b/crates/evals/Cargo.toml @@ -22,7 +22,6 @@ collections.workspace = true env_logger.workspace = true feature_flags.workspace = true fs.workspace = true -git.workspace = true gpui.workspace = true http_client.workspace = true language.workspace = true diff --git a/crates/evals/src/eval.rs b/crates/evals/src/eval.rs index 5953bd4c11..fd60221ba9 100644 --- a/crates/evals/src/eval.rs +++ b/crates/evals/src/eval.rs @@ -5,7 +5,6 @@ use client::{Client, UserStore}; use clock::RealSystemClock; use collections::BTreeMap; use feature_flags::FeatureFlagAppExt as _; -use git::GitHostingProviderRegistry; use gpui::{AppContext as _, AsyncApp, BackgroundExecutor, Entity}; use http_client::{HttpClient, Method}; use language::LanguageRegistry; @@ -274,8 +273,7 @@ async fn run_evaluation( let repos_dir = Path::new(EVAL_REPOS_DIR); let db_path = Path::new(EVAL_DB_PATH); let api_key = std::env::var("OPENAI_API_KEY").unwrap(); - let git_hosting_provider_registry = Arc::new(GitHostingProviderRegistry::new()); - let fs = Arc::new(RealFs::new(git_hosting_provider_registry, None)) as Arc; + let fs = Arc::new(RealFs::new(None)) as Arc; let clock = Arc::new(RealSystemClock); let client = cx .update(|cx| { diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs index f881726da3..05946de3b7 100644 --- a/crates/fs/src/fs.rs +++ b/crates/fs/src/fs.rs @@ -11,7 +11,6 @@ use collections::HashMap; use git::status::StatusCode; #[cfg(any(test, feature = "test-support"))] use git::status::TrackedStatus; -use git::GitHostingProviderRegistry; #[cfg(any(test, feature = "test-support"))] use git::{repository::RepoPath, status::FileStatus}; @@ -247,7 +246,6 @@ impl From for proto::Timestamp { #[derive(Default)] pub struct RealFs { - git_hosting_provider_registry: Arc, git_binary_path: Option, } @@ -300,14 +298,8 @@ impl FileHandle for std::fs::File { pub struct RealWatcher {} impl RealFs { - pub fn new( - git_hosting_provider_registry: Arc, - git_binary_path: Option, - ) -> Self { - Self { - git_hosting_provider_registry, - git_binary_path, - } + pub fn new(git_binary_path: Option) -> Self { + Self { git_binary_path } } } @@ -770,7 +762,6 @@ impl Fs for RealFs { Some(Arc::new(RealGitRepository::new( repo, self.git_binary_path.clone(), - self.git_hosting_provider_registry.clone(), ))) } diff --git a/crates/git/src/blame.rs b/crates/git/src/blame.rs index fcdd427c5a..71d61eeefc 100644 --- a/crates/git/src/blame.rs +++ b/crates/git/src/blame.rs @@ -1,17 +1,15 @@ use crate::commit::get_messages; -use crate::{parse_git_remote_url, BuildCommitPermalinkParams, GitHostingProviderRegistry, Oid}; +use crate::Oid; use anyhow::{anyhow, Context as _, Result}; use collections::{HashMap, HashSet}; use serde::{Deserialize, Serialize}; use std::io::Write; use std::process::Stdio; -use std::sync::Arc; use std::{ops::Range, path::Path}; use text::Rope; use time::macros::format_description; use time::OffsetDateTime; use time::UtcOffset; -use url::Url; pub use git2 as libgit; @@ -19,7 +17,6 @@ pub use git2 as libgit; pub struct Blame { pub entries: Vec, pub messages: HashMap, - pub permalinks: HashMap, pub remote_url: Option, } @@ -30,32 +27,15 @@ impl Blame { path: &Path, content: &Rope, remote_url: Option, - provider_registry: Arc, ) -> Result { let output = run_git_blame(git_binary, working_directory, path, content)?; let mut entries = parse_git_blame(&output)?; entries.sort_unstable_by(|a, b| a.range.start.cmp(&b.range.start)); - let mut permalinks = HashMap::default(); let mut unique_shas = HashSet::default(); - let parsed_remote_url = remote_url - .as_deref() - .and_then(|remote_url| parse_git_remote_url(provider_registry, remote_url)); for entry in entries.iter_mut() { unique_shas.insert(entry.sha); - // DEPRECATED (18 Apr 24): Sending permalinks over the wire is deprecated. Clients - // now do the parsing. - if let Some((provider, remote)) = parsed_remote_url.as_ref() { - permalinks.entry(entry.sha).or_insert_with(|| { - provider.build_commit_permalink( - remote, - BuildCommitPermalinkParams { - sha: entry.sha.to_string().as_str(), - }, - ) - }); - } } let shas = unique_shas.into_iter().collect::>(); @@ -64,7 +44,6 @@ impl Blame { Ok(Self { entries, - permalinks, messages, remote_url, }) diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rs index 9013d33c3c..99a490c0dc 100644 --- a/crates/git/src/repository.rs +++ b/crates/git/src/repository.rs @@ -1,5 +1,4 @@ use crate::status::FileStatus; -use crate::GitHostingProviderRegistry; use crate::{blame::Blame, status::GitStatus}; use anyhow::{anyhow, Context, Result}; use askpass::{AskPassResult, AskPassSession}; @@ -263,19 +262,13 @@ impl std::fmt::Debug for dyn GitRepository { pub struct RealGitRepository { pub repository: Mutex, pub git_binary_path: PathBuf, - hosting_provider_registry: Arc, } impl RealGitRepository { - pub fn new( - repository: git2::Repository, - git_binary_path: Option, - hosting_provider_registry: Arc, - ) -> Self { + pub fn new(repository: git2::Repository, git_binary_path: Option) -> Self { Self { repository: Mutex::new(repository), git_binary_path: git_binary_path.unwrap_or_else(|| PathBuf::from("git")), - hosting_provider_registry, } } @@ -617,7 +610,6 @@ impl GitRepository for RealGitRepository { path, &content, remote_url, - self.hosting_provider_registry.clone(), ) } diff --git a/crates/project/src/buffer_store.rs b/crates/project/src/buffer_store.rs index 04de596eb6..e514d91ec2 100644 --- a/crates/project/src/buffer_store.rs +++ b/crates/project/src/buffer_store.rs @@ -15,7 +15,6 @@ use git::{blame::Blame, repository::RepoPath}; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity, }; -use http_client::Url; use language::{ proto::{ deserialize_line_ending, deserialize_version, serialize_line_ending, serialize_version, @@ -34,7 +33,6 @@ use std::{ ops::Range, path::{Path, PathBuf}, pin::pin, - str::FromStr as _, sync::Arc, time::Instant, }; @@ -2776,20 +2774,10 @@ fn serialize_blame_buffer_response(blame: Option) -> proto::B }) .collect::>(); - let permalinks = blame - .permalinks - .into_iter() - .map(|(oid, url)| proto::CommitPermalink { - oid: oid.as_bytes().into(), - permalink: url.to_string(), - }) - .collect::>(); - proto::BlameBufferResponse { blame_response: Some(proto::blame_buffer_response::BlameResponse { entries, messages, - permalinks, remote_url: blame.remote_url, }), } @@ -2828,20 +2816,8 @@ fn deserialize_blame_buffer_response( .filter_map(|message| Some((git::Oid::from_bytes(&message.oid).ok()?, message.message))) .collect::>(); - let permalinks = response - .permalinks - .into_iter() - .filter_map(|permalink| { - Some(( - git::Oid::from_bytes(&permalink.oid).ok()?, - Url::from_str(&permalink.permalink).ok()?, - )) - }) - .collect::>(); - Some(Blame { entries, - permalinks, messages, remote_url: response.remote_url, }) diff --git a/crates/proto/proto/zed.proto b/crates/proto/proto/zed.proto index 5cc19ca51e..5feddb9269 100644 --- a/crates/proto/proto/zed.proto +++ b/crates/proto/proto/zed.proto @@ -2321,8 +2321,8 @@ message BlameBufferResponse { message BlameResponse { repeated BlameEntry entries = 1; repeated CommitMessage messages = 2; - repeated CommitPermalink permalinks = 3; optional string remote_url = 4; + reserved 3; } optional BlameResponse blame_response = 5; diff --git a/crates/remote_server/src/unix.rs b/crates/remote_server/src/unix.rs index def19f5ab3..d7eabaf648 100644 --- a/crates/remote_server/src/unix.rs +++ b/crates/remote_server/src/unix.rs @@ -445,7 +445,7 @@ pub fn execute_run( let extension_host_proxy = ExtensionHostProxy::global(cx); let project = cx.new(|cx| { - let fs = Arc::new(RealFs::new(Default::default(), None)); + let fs = Arc::new(RealFs::new(None)); let node_settings_rx = initialize_settings(session.clone(), fs.clone(), cx); let proxy_url = read_proxy_settings(cx); diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 4133a15867..f832fe7029 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -254,10 +254,7 @@ fn main() { }; log::info!("Using git binary path: {:?}", git_binary_path); - let fs = Arc::new(RealFs::new( - git_hosting_provider_registry.clone(), - git_binary_path, - )); + let fs = Arc::new(RealFs::new(git_binary_path)); let user_settings_file_rx = watch_config_file( &app.background_executor(), fs.clone(),