Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

git_ui: Make git_ui call support optional (#58413)

Ben Brandt5efd6f68c7ed
diff --git a/crates/eval_cli/zed_eval/pyproject.toml b/crates/eval_cli/zed_eval/pyproject.toml
index 07a61d7a13b..e25ec9825c0 100644
--- a/crates/eval_cli/zed_eval/pyproject.toml
+++ b/crates/eval_cli/zed_eval/pyproject.toml
@@ -3,7 +3,7 @@ name = "zed-eval"
version = "0.1.0"
description = "Harbor agent wrapper for Zed's eval-cli"
requires-python = ">=3.12"
-dependencies = ["harbor==0.7.0"]
+dependencies = ["harbor==0.13.0"]
[build-system]
requires = ["setuptools"]
diff --git a/crates/git_ui/Cargo.toml b/crates/git_ui/Cargo.toml
index 829ba4f9d8c..e65265264b8 100644
--- a/crates/git_ui/Cargo.toml
+++ b/crates/git_ui/Cargo.toml
@@ -14,6 +14,7 @@ path = "src/git_ui.rs"
[features]
test-support = ["multi_buffer/test-support", "remote_connection/test-support"]
+call = ["dep:call"]
[dependencies]
agent_settings.workspace = true
@@ -21,7 +22,7 @@ anyhow.workspace = true
askpass.workspace = true
async-channel.workspace = true
buffer_diff.workspace = true
-call.workspace = true
+call = { workspace = true, optional = true }
collections.workspace = true
component.workspace = true
db.workspace = true
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 70a9f7bb569..93064b0e36f 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -673,6 +673,8 @@ pub struct GitPanel {
context_menu: Option<(Entity<ContextMenu>, Point<Pixels>, Subscription)>,
modal_open: bool,
show_placeholders: bool,
+ // Only read to compute collaborative co-authors, which requires the `call` feature.
+ #[cfg_attr(not(feature = "call"), allow(dead_code))]
local_committer: Option<GitCommitter>,
local_committer_task: Option<Task<()>>,
commit_template: Option<GitCommitTemplate>,
@@ -3347,6 +3349,12 @@ impl GitPanel {
}
}
+ #[cfg(not(feature = "call"))]
+ fn potential_co_authors(&self, _cx: &App) -> Vec<(String, String)> {
+ Vec::new()
+ }
+
+ #[cfg(feature = "call")]
fn potential_co_authors(&self, cx: &App) -> Vec<(String, String)> {
let mut new_co_authors = Vec::new();
let project = self.project.read(cx);
@@ -3388,6 +3396,7 @@ impl GitPanel {
new_co_authors
}
+ #[cfg(feature = "call")]
fn local_committer(&self, room: &call::Room, cx: &App) -> Option<(String, String)> {
let user = room.local_participant_user(cx)?;
let committer = self.local_committer.as_ref()?;
@@ -6636,19 +6645,24 @@ impl Render for GitPanel {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let project = self.project.read(cx);
let has_entries = !self.entries.is_empty();
- let room = self.workspace.upgrade().and_then(|_workspace| {
- call::ActiveCall::try_global(cx).and_then(|call| call.read(cx).room().cloned())
- });
-
let has_write_access = self.has_write_access(cx);
- let has_co_authors = room.is_some_and(|room| {
- self.load_local_committer(cx);
- let room = room.read(cx);
- room.remote_participants()
- .values()
- .any(|remote_participant| remote_participant.can_write())
- });
+ #[cfg(feature = "call")]
+ let has_co_authors = self
+ .workspace
+ .upgrade()
+ .and_then(|_workspace| {
+ call::ActiveCall::try_global(cx).and_then(|call| call.read(cx).room().cloned())
+ })
+ .is_some_and(|room| {
+ self.load_local_committer(cx);
+ let room = room.read(cx);
+ room.remote_participants()
+ .values()
+ .any(|remote_participant| remote_participant.can_write())
+ });
+ #[cfg(not(feature = "call"))]
+ let has_co_authors = false;
v_flex()
.id("git_panel")
diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml
index b0cbcb4d08a..3938d3a1ba6 100644
--- a/crates/zed/Cargo.toml
+++ b/crates/zed/Cargo.toml
@@ -114,7 +114,7 @@ fs.workspace = true
futures.workspace = true
git.workspace = true
git_hosting_providers.workspace = true
-git_ui.workspace = true
+git_ui = { workspace = true, features = ["call"] }
go_to_line.workspace = true
system_specs.workspace = true
gpui = { workspace = true, features = ["input-latency-histogram"] }