Cargo.lock 🔗
@@ -2832,7 +2832,6 @@ dependencies = [
"parking_lot 0.11.2",
"regex",
"rope",
- "rpc",
"serde",
"serde_derive",
"serde_json",
Max Brunsfeld created
Cargo.lock | 1 -
crates/fs/Cargo.toml | 1 -
crates/fs/src/repository.rs | 20 +-------------------
crates/language/Cargo.toml | 1 -
crates/project/src/worktree.rs | 22 ++++++++++++++++++++--
5 files changed, 21 insertions(+), 24 deletions(-)
@@ -2832,7 +2832,6 @@ dependencies = [
"parking_lot 0.11.2",
"regex",
"rope",
- "rpc",
"serde",
"serde_derive",
"serde_json",
@@ -13,7 +13,6 @@ rope = { path = "../rope" }
text = { path = "../text" }
util = { path = "../util" }
sum_tree = { path = "../sum_tree" }
-rpc = { path = "../rpc" }
anyhow.workspace = true
async-trait.workspace = true
@@ -2,7 +2,6 @@ use anyhow::Result;
use collections::HashMap;
use git2::{BranchType, StatusShow};
use parking_lot::Mutex;
-use rpc::proto;
use serde_derive::{Deserialize, Serialize};
use std::{
cmp::Ordering,
@@ -23,6 +22,7 @@ pub struct Branch {
/// Timestamp of most recent commit, normalized to Unix Epoch format.
pub unix_timestamp: Option<i64>,
}
+
#[async_trait::async_trait]
pub trait GitRepository: Send {
fn reload_index(&self);
@@ -358,24 +358,6 @@ impl GitFileStatus {
}
}
}
-
- pub fn from_proto(git_status: Option<i32>) -> Option<GitFileStatus> {
- git_status.and_then(|status| {
- proto::GitStatus::from_i32(status).map(|status| match status {
- proto::GitStatus::Added => GitFileStatus::Added,
- proto::GitStatus::Modified => GitFileStatus::Modified,
- proto::GitStatus::Conflict => GitFileStatus::Conflict,
- })
- })
- }
-
- pub fn to_proto(self) -> i32 {
- match self {
- GitFileStatus::Added => proto::GitStatus::Added as i32,
- GitFileStatus::Modified => proto::GitStatus::Modified as i32,
- GitFileStatus::Conflict => proto::GitStatus::Conflict as i32,
- }
- }
}
#[derive(Clone, Debug, Ord, Hash, PartialOrd, Eq, PartialEq)]
@@ -22,7 +22,6 @@ test-support = [
]
[dependencies]
-client = { path = "../client" }
clock = { path = "../clock" }
collections = { path = "../collections" }
fuzzy = { path = "../fuzzy" }
@@ -4310,7 +4310,7 @@ impl<'a> From<&'a Entry> for proto::Entry {
is_symlink: entry.is_symlink,
is_ignored: entry.is_ignored,
is_external: entry.is_external,
- git_status: entry.git_status.map(|status| status.to_proto()),
+ git_status: entry.git_status.map(git_status_to_proto),
}
}
}
@@ -4337,7 +4337,7 @@ impl<'a> TryFrom<(&'a CharBag, proto::Entry)> for Entry {
is_symlink: entry.is_symlink,
is_ignored: entry.is_ignored,
is_external: entry.is_external,
- git_status: GitFileStatus::from_proto(entry.git_status),
+ git_status: git_status_from_proto(entry.git_status),
})
} else {
Err(anyhow!(
@@ -4366,3 +4366,21 @@ fn combine_git_statuses(
unstaged
}
}
+
+fn git_status_from_proto(git_status: Option<i32>) -> Option<GitFileStatus> {
+ git_status.and_then(|status| {
+ proto::GitStatus::from_i32(status).map(|status| match status {
+ proto::GitStatus::Added => GitFileStatus::Added,
+ proto::GitStatus::Modified => GitFileStatus::Modified,
+ proto::GitStatus::Conflict => GitFileStatus::Conflict,
+ })
+ })
+}
+
+fn git_status_to_proto(status: GitFileStatus) -> i32 {
+ match status {
+ GitFileStatus::Added => proto::GitStatus::Added as i32,
+ GitFileStatus::Modified => proto::GitStatus::Modified as i32,
+ GitFileStatus::Conflict => proto::GitStatus::Conflict as i32,
+ }
+}