Make GitRepository::status
async and remove cx parameter (#27514)
This lays the groundwork for using `status` as part of the new agent panel. Release Notes: - N/A
This commit is contained in:
parent
926d10cc45
commit
7354ef91e1
19 changed files with 662 additions and 716 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -4749,6 +4749,7 @@ dependencies = [
|
||||||
"env_logger 0.11.7",
|
"env_logger 0.11.7",
|
||||||
"extension",
|
"extension",
|
||||||
"fs",
|
"fs",
|
||||||
|
"gpui",
|
||||||
"language",
|
"language",
|
||||||
"log",
|
"log",
|
||||||
"reqwest_client",
|
"reqwest_client",
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ impl Thread {
|
||||||
|
|
||||||
// Get diff asynchronously
|
// Get diff asynchronously
|
||||||
let diff = repo
|
let diff = repo
|
||||||
.diff(git::repository::DiffType::HeadToWorktree, cx.clone())
|
.diff(git::repository::DiffType::HeadToWorktree)
|
||||||
.await
|
.await
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,10 @@ pub fn init(cx: &mut App) -> Arc<HeadlessAppState> {
|
||||||
cx.set_http_client(client.http_client().clone());
|
cx.set_http_client(client.http_client().clone());
|
||||||
|
|
||||||
let git_binary_path = None;
|
let git_binary_path = None;
|
||||||
let fs = Arc::new(RealFs::new(git_binary_path));
|
let fs = Arc::new(RealFs::new(
|
||||||
|
git_binary_path,
|
||||||
|
cx.background_executor().clone(),
|
||||||
|
));
|
||||||
|
|
||||||
let languages = Arc::new(LanguageRegistry::new(cx.background_executor().clone()));
|
let languages = Arc::new(LanguageRegistry::new(cx.background_executor().clone()));
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ async fn run_evaluation(
|
||||||
let repos_dir = Path::new(EVAL_REPOS_DIR);
|
let repos_dir = Path::new(EVAL_REPOS_DIR);
|
||||||
let db_path = Path::new(EVAL_DB_PATH);
|
let db_path = Path::new(EVAL_DB_PATH);
|
||||||
let api_key = std::env::var("OPENAI_API_KEY").unwrap();
|
let api_key = std::env::var("OPENAI_API_KEY").unwrap();
|
||||||
let fs = Arc::new(RealFs::new(None)) as Arc<dyn Fs>;
|
let fs = Arc::new(RealFs::new(None, cx.background_executor().clone())) as Arc<dyn Fs>;
|
||||||
let clock = Arc::new(RealSystemClock);
|
let clock = Arc::new(RealSystemClock);
|
||||||
let client = cx
|
let client = cx
|
||||||
.update(|cx| {
|
.update(|cx| {
|
||||||
|
|
|
@ -18,6 +18,7 @@ clap = { workspace = true, features = ["derive"] }
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
extension.workspace = true
|
extension.workspace = true
|
||||||
fs.workspace = true
|
fs.workspace = true
|
||||||
|
gpui.workspace = true
|
||||||
language.workspace = true
|
language.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
reqwest_client.workspace = true
|
reqwest_client.workspace = true
|
||||||
|
|
|
@ -34,7 +34,7 @@ async fn main() -> Result<()> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
let fs = Arc::new(RealFs::default());
|
let fs = Arc::new(RealFs::new(None, gpui::background_executor()));
|
||||||
let engine = wasmtime::Engine::default();
|
let engine = wasmtime::Engine::default();
|
||||||
let mut wasm_store = WasmStore::new(&engine)?;
|
let mut wasm_store = WasmStore::new(&engine)?;
|
||||||
|
|
||||||
|
|
|
@ -477,7 +477,7 @@ async fn test_extension_store_with_test_extension(cx: &mut TestAppContext) {
|
||||||
let test_extension_id = "test-extension";
|
let test_extension_id = "test-extension";
|
||||||
let test_extension_dir = root_dir.join("extensions").join(test_extension_id);
|
let test_extension_dir = root_dir.join("extensions").join(test_extension_id);
|
||||||
|
|
||||||
let fs = Arc::new(RealFs::default());
|
let fs = Arc::new(RealFs::new(None, cx.executor()));
|
||||||
let extensions_dir = TempTree::new(json!({
|
let extensions_dir = TempTree::new(json!({
|
||||||
"installed": {},
|
"installed": {},
|
||||||
"work": {}
|
"work": {}
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl FakeGitRepository {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_state_async<F, T>(&self, write: bool, f: F) -> BoxFuture<Result<T>>
|
fn with_state_async<F, T>(&self, write: bool, f: F) -> BoxFuture<'static, Result<T>>
|
||||||
where
|
where
|
||||||
F: 'static + Send + FnOnce(&mut FakeGitRepositoryState) -> Result<T>,
|
F: 'static + Send + FnOnce(&mut FakeGitRepositoryState) -> Result<T>,
|
||||||
T: Send,
|
T: Send,
|
||||||
|
@ -81,7 +81,7 @@ impl FakeGitRepository {
|
||||||
impl GitRepository for FakeGitRepository {
|
impl GitRepository for FakeGitRepository {
|
||||||
fn reload_index(&self) {}
|
fn reload_index(&self) {}
|
||||||
|
|
||||||
fn load_index_text(&self, path: RepoPath, _cx: AsyncApp) -> BoxFuture<Option<String>> {
|
fn load_index_text(&self, path: RepoPath) -> BoxFuture<Option<String>> {
|
||||||
async {
|
async {
|
||||||
self.with_state_async(false, move |state| {
|
self.with_state_async(false, move |state| {
|
||||||
state
|
state
|
||||||
|
@ -96,7 +96,7 @@ impl GitRepository for FakeGitRepository {
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_committed_text(&self, path: RepoPath, _cx: AsyncApp) -> BoxFuture<Option<String>> {
|
fn load_committed_text(&self, path: RepoPath) -> BoxFuture<Option<String>> {
|
||||||
async {
|
async {
|
||||||
self.with_state_async(false, move |state| {
|
self.with_state_async(false, move |state| {
|
||||||
state
|
state
|
||||||
|
@ -116,7 +116,6 @@ impl GitRepository for FakeGitRepository {
|
||||||
path: RepoPath,
|
path: RepoPath,
|
||||||
content: Option<String>,
|
content: Option<String>,
|
||||||
_env: HashMap<String, String>,
|
_env: HashMap<String, String>,
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<anyhow::Result<()>> {
|
) -> BoxFuture<anyhow::Result<()>> {
|
||||||
self.with_state_async(true, move |state| {
|
self.with_state_async(true, move |state| {
|
||||||
if let Some(message) = state.simulated_index_write_error_message.clone() {
|
if let Some(message) = state.simulated_index_write_error_message.clone() {
|
||||||
|
@ -142,7 +141,7 @@ impl GitRepository for FakeGitRepository {
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show(&self, _commit: String, _cx: AsyncApp) -> BoxFuture<Result<CommitDetails>> {
|
fn show(&self, _commit: String) -> BoxFuture<Result<CommitDetails>> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +171,12 @@ impl GitRepository for FakeGitRepository {
|
||||||
self.path()
|
self.path()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn status(&self, path_prefixes: &[RepoPath]) -> Result<GitStatus> {
|
fn status(&self, path_prefixes: &[RepoPath]) -> BoxFuture<'static, Result<GitStatus>> {
|
||||||
|
let status = self.status_blocking(path_prefixes);
|
||||||
|
async move { status }.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn status_blocking(&self, path_prefixes: &[RepoPath]) -> Result<GitStatus> {
|
||||||
let workdir_path = self.dot_git_path.parent().unwrap();
|
let workdir_path = self.dot_git_path.parent().unwrap();
|
||||||
|
|
||||||
// Load gitignores
|
// Load gitignores
|
||||||
|
@ -317,26 +321,21 @@ impl GitRepository for FakeGitRepository {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn change_branch(&self, name: String, _cx: AsyncApp) -> BoxFuture<Result<()>> {
|
fn change_branch(&self, name: String) -> BoxFuture<Result<()>> {
|
||||||
self.with_state_async(true, |state| {
|
self.with_state_async(true, |state| {
|
||||||
state.current_branch_name = Some(name);
|
state.current_branch_name = Some(name);
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_branch(&self, name: String, _: AsyncApp) -> BoxFuture<Result<()>> {
|
fn create_branch(&self, name: String) -> BoxFuture<Result<()>> {
|
||||||
self.with_state_async(true, move |state| {
|
self.with_state_async(true, move |state| {
|
||||||
state.branches.insert(name.to_owned());
|
state.branches.insert(name.to_owned());
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blame(
|
fn blame(&self, path: RepoPath, _content: Rope) -> BoxFuture<Result<git::blame::Blame>> {
|
||||||
&self,
|
|
||||||
path: RepoPath,
|
|
||||||
_content: Rope,
|
|
||||||
_cx: &mut AsyncApp,
|
|
||||||
) -> BoxFuture<Result<git::blame::Blame>> {
|
|
||||||
self.with_state_async(false, move |state| {
|
self.with_state_async(false, move |state| {
|
||||||
state
|
state
|
||||||
.blames
|
.blames
|
||||||
|
@ -350,7 +349,6 @@ impl GitRepository for FakeGitRepository {
|
||||||
&self,
|
&self,
|
||||||
_paths: Vec<RepoPath>,
|
_paths: Vec<RepoPath>,
|
||||||
_env: HashMap<String, String>,
|
_env: HashMap<String, String>,
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<Result<()>> {
|
) -> BoxFuture<Result<()>> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
@ -359,7 +357,6 @@ impl GitRepository for FakeGitRepository {
|
||||||
&self,
|
&self,
|
||||||
_paths: Vec<RepoPath>,
|
_paths: Vec<RepoPath>,
|
||||||
_env: HashMap<String, String>,
|
_env: HashMap<String, String>,
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<Result<()>> {
|
) -> BoxFuture<Result<()>> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
@ -369,7 +366,6 @@ impl GitRepository for FakeGitRepository {
|
||||||
_message: gpui::SharedString,
|
_message: gpui::SharedString,
|
||||||
_name_and_email: Option<(gpui::SharedString, gpui::SharedString)>,
|
_name_and_email: Option<(gpui::SharedString, gpui::SharedString)>,
|
||||||
_env: HashMap<String, String>,
|
_env: HashMap<String, String>,
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<Result<()>> {
|
) -> BoxFuture<Result<()>> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
@ -406,38 +402,23 @@ impl GitRepository for FakeGitRepository {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_remotes(
|
fn get_remotes(&self, _branch: Option<String>) -> BoxFuture<Result<Vec<Remote>>> {
|
||||||
&self,
|
|
||||||
_branch: Option<String>,
|
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<Result<Vec<Remote>>> {
|
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_for_pushed_commit(
|
fn check_for_pushed_commit(&self) -> BoxFuture<Result<Vec<gpui::SharedString>>> {
|
||||||
&self,
|
|
||||||
_cx: gpui::AsyncApp,
|
|
||||||
) -> BoxFuture<Result<Vec<gpui::SharedString>>> {
|
|
||||||
future::ready(Ok(Vec::new())).boxed()
|
future::ready(Ok(Vec::new())).boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn diff(
|
fn diff(&self, _diff: git::repository::DiffType) -> BoxFuture<Result<String>> {
|
||||||
&self,
|
|
||||||
_diff: git::repository::DiffType,
|
|
||||||
_cx: gpui::AsyncApp,
|
|
||||||
) -> BoxFuture<Result<String>> {
|
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn checkpoint(&self, _cx: AsyncApp) -> BoxFuture<Result<GitRepositoryCheckpoint>> {
|
fn checkpoint(&self) -> BoxFuture<Result<GitRepositoryCheckpoint>> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restore_checkpoint(
|
fn restore_checkpoint(&self, _checkpoint: GitRepositoryCheckpoint) -> BoxFuture<Result<()>> {
|
||||||
&self,
|
|
||||||
_checkpoint: GitRepositoryCheckpoint,
|
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<Result<()>> {
|
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,16 +426,11 @@ impl GitRepository for FakeGitRepository {
|
||||||
&self,
|
&self,
|
||||||
_left: GitRepositoryCheckpoint,
|
_left: GitRepositoryCheckpoint,
|
||||||
_right: GitRepositoryCheckpoint,
|
_right: GitRepositoryCheckpoint,
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<Result<bool>> {
|
) -> BoxFuture<Result<bool>> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn delete_checkpoint(
|
fn delete_checkpoint(&self, _checkpoint: GitRepositoryCheckpoint) -> BoxFuture<Result<()>> {
|
||||||
&self,
|
|
||||||
_checkpoint: GitRepositoryCheckpoint,
|
|
||||||
_cx: AsyncApp,
|
|
||||||
) -> BoxFuture<Result<()>> {
|
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use anyhow::{anyhow, Context as _, Result};
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
use ashpd::desktop::trash;
|
use ashpd::desktop::trash;
|
||||||
use gpui::App;
|
use gpui::App;
|
||||||
|
use gpui::BackgroundExecutor;
|
||||||
use gpui::Global;
|
use gpui::Global;
|
||||||
use gpui::ReadGlobal as _;
|
use gpui::ReadGlobal as _;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -240,9 +241,9 @@ impl From<MTime> for proto::Timestamp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub struct RealFs {
|
pub struct RealFs {
|
||||||
git_binary_path: Option<PathBuf>,
|
git_binary_path: Option<PathBuf>,
|
||||||
|
executor: BackgroundExecutor,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FileHandle: Send + Sync + std::fmt::Debug {
|
pub trait FileHandle: Send + Sync + std::fmt::Debug {
|
||||||
|
@ -294,8 +295,11 @@ impl FileHandle for std::fs::File {
|
||||||
pub struct RealWatcher {}
|
pub struct RealWatcher {}
|
||||||
|
|
||||||
impl RealFs {
|
impl RealFs {
|
||||||
pub fn new(git_binary_path: Option<PathBuf>) -> Self {
|
pub fn new(git_binary_path: Option<PathBuf>, executor: BackgroundExecutor) -> Self {
|
||||||
Self { git_binary_path }
|
Self {
|
||||||
|
git_binary_path,
|
||||||
|
executor,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,6 +758,7 @@ impl Fs for RealFs {
|
||||||
Some(Arc::new(RealGitRepository::new(
|
Some(Arc::new(RealGitRepository::new(
|
||||||
dotgit_path,
|
dotgit_path,
|
||||||
self.git_binary_path.clone(),
|
self.git_binary_path.clone(),
|
||||||
|
self.executor.clone(),
|
||||||
)?))
|
)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
||||||
use crate::repository::RepoPath;
|
use crate::repository::RepoPath;
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{path::Path, process::Stdio, sync::Arc};
|
use std::{path::Path, str::FromStr, sync::Arc};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
@ -443,45 +443,11 @@ pub struct GitStatus {
|
||||||
pub entries: Arc<[(RepoPath, FileStatus)]>,
|
pub entries: Arc<[(RepoPath, FileStatus)]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GitStatus {
|
impl FromStr for GitStatus {
|
||||||
pub(crate) fn new(
|
type Err = anyhow::Error;
|
||||||
git_binary: &Path,
|
|
||||||
working_directory: &Path,
|
|
||||||
path_prefixes: &[RepoPath],
|
|
||||||
) -> Result<Self> {
|
|
||||||
let child = util::command::new_std_command(git_binary)
|
|
||||||
.current_dir(working_directory)
|
|
||||||
.args([
|
|
||||||
"--no-optional-locks",
|
|
||||||
"status",
|
|
||||||
"--porcelain=v1",
|
|
||||||
"--untracked-files=all",
|
|
||||||
"--no-renames",
|
|
||||||
"-z",
|
|
||||||
])
|
|
||||||
.args(path_prefixes.iter().map(|path_prefix| {
|
|
||||||
if path_prefix.0.as_ref() == Path::new("") {
|
|
||||||
Path::new(".")
|
|
||||||
} else {
|
|
||||||
path_prefix
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.stdin(Stdio::null())
|
|
||||||
.stdout(Stdio::piped())
|
|
||||||
.stderr(Stdio::piped())
|
|
||||||
.spawn()
|
|
||||||
.map_err(|e| anyhow!("Failed to start git status process: {e}"))?;
|
|
||||||
|
|
||||||
let output = child
|
fn from_str(s: &str) -> Result<Self> {
|
||||||
.wait_with_output()
|
let mut entries = s
|
||||||
.map_err(|e| anyhow!("Failed to read git status output: {e}"))?;
|
|
||||||
|
|
||||||
if !output.status.success() {
|
|
||||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
||||||
return Err(anyhow!("git status process failed: {stderr}"));
|
|
||||||
}
|
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
|
||||||
let mut entries = stdout
|
|
||||||
.split('\0')
|
.split('\0')
|
||||||
.filter_map(|entry| {
|
.filter_map(|entry| {
|
||||||
let sep = entry.get(2..3)?;
|
let sep = entry.get(2..3)?;
|
||||||
|
|
|
@ -74,6 +74,11 @@ pub(crate) use windows::*;
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub use test::TestScreenCaptureSource;
|
pub use test::TestScreenCaptureSource;
|
||||||
|
|
||||||
|
/// Returns a background executor for the current platform.
|
||||||
|
pub fn background_executor() -> BackgroundExecutor {
|
||||||
|
current_platform(true).background_executor()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub(crate) fn current_platform(headless: bool) -> Rc<dyn Platform> {
|
pub(crate) fn current_platform(headless: bool) -> Rc<dyn Platform> {
|
||||||
Rc::new(MacPlatform::new(headless))
|
Rc::new(MacPlatform::new(headless))
|
||||||
|
|
|
@ -773,11 +773,11 @@ impl GitStore {
|
||||||
anyhow::Ok(Some((repo, relative_path, content)))
|
anyhow::Ok(Some((repo, relative_path, content)))
|
||||||
});
|
});
|
||||||
|
|
||||||
cx.spawn(async move |cx| {
|
cx.spawn(async move |_cx| {
|
||||||
let Some((repo, relative_path, content)) = blame_params? else {
|
let Some((repo, relative_path, content)) = blame_params? else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
repo.blame(relative_path.clone(), content, cx)
|
repo.blame(relative_path.clone(), content)
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("Failed to blame {:?}", relative_path.0))
|
.with_context(|| format!("Failed to blame {:?}", relative_path.0))
|
||||||
.map(Some)
|
.map(Some)
|
||||||
|
@ -1282,16 +1282,13 @@ impl GitStore {
|
||||||
let index_text = if current_index_text.is_some() {
|
let index_text = if current_index_text.is_some() {
|
||||||
local_repo
|
local_repo
|
||||||
.repo()
|
.repo()
|
||||||
.load_index_text(relative_path.clone(), cx.clone())
|
.load_index_text(relative_path.clone())
|
||||||
.await
|
.await
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
let head_text = if current_head_text.is_some() {
|
let head_text = if current_head_text.is_some() {
|
||||||
local_repo
|
local_repo.repo().load_committed_text(relative_path).await
|
||||||
.repo()
|
|
||||||
.load_committed_text(relative_path, cx.clone())
|
|
||||||
.await
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
@ -2832,9 +2829,9 @@ impl Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show(&self, commit: String) -> oneshot::Receiver<Result<CommitDetails>> {
|
pub fn show(&self, commit: String) -> oneshot::Receiver<Result<CommitDetails>> {
|
||||||
self.send_job(|git_repo, cx| async move {
|
self.send_job(|git_repo, _cx| async move {
|
||||||
match git_repo {
|
match git_repo {
|
||||||
RepositoryState::Local(git_repository) => git_repository.show(commit, cx).await,
|
RepositoryState::Local(git_repository) => git_repository.show(commit).await,
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
client,
|
client,
|
||||||
|
@ -2901,9 +2898,9 @@ impl Repository {
|
||||||
let env = env.await;
|
let env = env.await;
|
||||||
|
|
||||||
this.update(cx, |this, _| {
|
this.update(cx, |this, _| {
|
||||||
this.send_job(|git_repo, cx| async move {
|
this.send_job(|git_repo, _cx| async move {
|
||||||
match git_repo {
|
match git_repo {
|
||||||
RepositoryState::Local(repo) => repo.stage_paths(entries, env, cx).await,
|
RepositoryState::Local(repo) => repo.stage_paths(entries, env).await,
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
client,
|
client,
|
||||||
|
@ -2969,9 +2966,9 @@ impl Repository {
|
||||||
let env = env.await;
|
let env = env.await;
|
||||||
|
|
||||||
this.update(cx, |this, _| {
|
this.update(cx, |this, _| {
|
||||||
this.send_job(|git_repo, cx| async move {
|
this.send_job(|git_repo, _cx| async move {
|
||||||
match git_repo {
|
match git_repo {
|
||||||
RepositoryState::Local(repo) => repo.unstage_paths(entries, env, cx).await,
|
RepositoryState::Local(repo) => repo.unstage_paths(entries, env).await,
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
client,
|
client,
|
||||||
|
@ -3055,11 +3052,11 @@ impl Repository {
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> oneshot::Receiver<Result<()>> {
|
) -> oneshot::Receiver<Result<()>> {
|
||||||
let env = self.worktree_environment(cx);
|
let env = self.worktree_environment(cx);
|
||||||
self.send_job(|git_repo, cx| async move {
|
self.send_job(|git_repo, _cx| async move {
|
||||||
match git_repo {
|
match git_repo {
|
||||||
RepositoryState::Local(repo) => {
|
RepositoryState::Local(repo) => {
|
||||||
let env = env.await;
|
let env = env.await;
|
||||||
repo.commit(message, name_and_email, env, cx).await
|
repo.commit(message, name_and_email, env).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
|
@ -3254,10 +3251,10 @@ impl Repository {
|
||||||
|
|
||||||
self.send_keyed_job(
|
self.send_keyed_job(
|
||||||
Some(GitJobKey::WriteIndex(path.clone())),
|
Some(GitJobKey::WriteIndex(path.clone())),
|
||||||
|git_repo, cx| async {
|
|git_repo, _cx| async {
|
||||||
match git_repo {
|
match git_repo {
|
||||||
RepositoryState::Local(repo) => {
|
RepositoryState::Local(repo) => {
|
||||||
repo.set_index_text(path, content, env.await, cx).await
|
repo.set_index_text(path, content, env.await).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
|
@ -3283,10 +3280,10 @@ impl Repository {
|
||||||
&self,
|
&self,
|
||||||
branch_name: Option<String>,
|
branch_name: Option<String>,
|
||||||
) -> oneshot::Receiver<Result<Vec<Remote>>> {
|
) -> oneshot::Receiver<Result<Vec<Remote>>> {
|
||||||
self.send_job(|repo, cx| async move {
|
self.send_job(|repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => {
|
RepositoryState::Local(git_repository) => {
|
||||||
git_repository.get_remotes(branch_name, cx).await
|
git_repository.get_remotes(branch_name).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
|
@ -3352,9 +3349,9 @@ impl Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn diff(&self, diff_type: DiffType, _cx: &App) -> oneshot::Receiver<Result<String>> {
|
pub fn diff(&self, diff_type: DiffType, _cx: &App) -> oneshot::Receiver<Result<String>> {
|
||||||
self.send_job(|repo, cx| async move {
|
self.send_job(|repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => git_repository.diff(diff_type, cx).await,
|
RepositoryState::Local(git_repository) => git_repository.diff(diff_type).await,
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
client,
|
client,
|
||||||
|
@ -3383,10 +3380,10 @@ impl Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_branch(&self, branch_name: String) -> oneshot::Receiver<Result<()>> {
|
pub fn create_branch(&self, branch_name: String) -> oneshot::Receiver<Result<()>> {
|
||||||
self.send_job(|repo, cx| async move {
|
self.send_job(|repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => {
|
RepositoryState::Local(git_repository) => {
|
||||||
git_repository.create_branch(branch_name, cx).await
|
git_repository.create_branch(branch_name).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
|
@ -3408,10 +3405,10 @@ impl Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn change_branch(&self, branch_name: String) -> oneshot::Receiver<Result<()>> {
|
pub fn change_branch(&self, branch_name: String) -> oneshot::Receiver<Result<()>> {
|
||||||
self.send_job(|repo, cx| async move {
|
self.send_job(|repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => {
|
RepositoryState::Local(git_repository) => {
|
||||||
git_repository.change_branch(branch_name, cx).await
|
git_repository.change_branch(branch_name).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
|
@ -3433,10 +3430,10 @@ impl Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_for_pushed_commits(&self) -> oneshot::Receiver<Result<Vec<SharedString>>> {
|
pub fn check_for_pushed_commits(&self) -> oneshot::Receiver<Result<Vec<SharedString>>> {
|
||||||
self.send_job(|repo, cx| async move {
|
self.send_job(|repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => {
|
RepositoryState::Local(git_repository) => {
|
||||||
git_repository.check_for_pushed_commit(cx).await
|
git_repository.check_for_pushed_commit().await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote {
|
RepositoryState::Remote {
|
||||||
project_id,
|
project_id,
|
||||||
|
@ -3459,9 +3456,9 @@ impl Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn checkpoint(&self) -> oneshot::Receiver<Result<GitRepositoryCheckpoint>> {
|
pub fn checkpoint(&self) -> oneshot::Receiver<Result<GitRepositoryCheckpoint>> {
|
||||||
self.send_job(|repo, cx| async move {
|
self.send_job(|repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => git_repository.checkpoint(cx).await,
|
RepositoryState::Local(git_repository) => git_repository.checkpoint().await,
|
||||||
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -3471,10 +3468,10 @@ impl Repository {
|
||||||
&self,
|
&self,
|
||||||
checkpoint: GitRepositoryCheckpoint,
|
checkpoint: GitRepositoryCheckpoint,
|
||||||
) -> oneshot::Receiver<Result<()>> {
|
) -> oneshot::Receiver<Result<()>> {
|
||||||
self.send_job(move |repo, cx| async move {
|
self.send_job(move |repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => {
|
RepositoryState::Local(git_repository) => {
|
||||||
git_repository.restore_checkpoint(checkpoint, cx).await
|
git_repository.restore_checkpoint(checkpoint).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
||||||
}
|
}
|
||||||
|
@ -3513,10 +3510,10 @@ impl Repository {
|
||||||
left: GitRepositoryCheckpoint,
|
left: GitRepositoryCheckpoint,
|
||||||
right: GitRepositoryCheckpoint,
|
right: GitRepositoryCheckpoint,
|
||||||
) -> oneshot::Receiver<Result<bool>> {
|
) -> oneshot::Receiver<Result<bool>> {
|
||||||
self.send_job(move |repo, cx| async move {
|
self.send_job(move |repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => {
|
RepositoryState::Local(git_repository) => {
|
||||||
git_repository.compare_checkpoints(left, right, cx).await
|
git_repository.compare_checkpoints(left, right).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
||||||
}
|
}
|
||||||
|
@ -3527,10 +3524,10 @@ impl Repository {
|
||||||
&self,
|
&self,
|
||||||
checkpoint: GitRepositoryCheckpoint,
|
checkpoint: GitRepositoryCheckpoint,
|
||||||
) -> oneshot::Receiver<Result<()>> {
|
) -> oneshot::Receiver<Result<()>> {
|
||||||
self.send_job(move |repo, cx| async move {
|
self.send_job(move |repo, _cx| async move {
|
||||||
match repo {
|
match repo {
|
||||||
RepositoryState::Local(git_repository) => {
|
RepositoryState::Local(git_repository) => {
|
||||||
git_repository.delete_checkpoint(checkpoint, cx).await
|
git_repository.delete_checkpoint(checkpoint).await
|
||||||
}
|
}
|
||||||
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
RepositoryState::Remote { .. } => Err(anyhow!("not implemented yet")),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1476,7 +1476,7 @@ impl Project {
|
||||||
) -> Entity<Project> {
|
) -> Entity<Project> {
|
||||||
use clock::FakeSystemClock;
|
use clock::FakeSystemClock;
|
||||||
|
|
||||||
let fs = Arc::new(RealFs::default());
|
let fs = Arc::new(RealFs::new(None, cx.background_executor().clone()));
|
||||||
let languages = LanguageRegistry::test(cx.background_executor().clone());
|
let languages = LanguageRegistry::test(cx.background_executor().clone());
|
||||||
let clock = Arc::new(FakeSystemClock::new());
|
let clock = Arc::new(FakeSystemClock::new());
|
||||||
let http_client = http_client::FakeHttpClient::with_404_response();
|
let http_client = http_client::FakeHttpClient::with_404_response();
|
||||||
|
|
|
@ -99,7 +99,12 @@ async fn test_symlinks(cx: &mut gpui::TestAppContext) {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let project = Project::test(Arc::new(RealFs::default()), [root_link_path.as_ref()], cx).await;
|
let project = Project::test(
|
||||||
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
|
[root_link_path.as_ref()],
|
||||||
|
cx,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
project.update(cx, |project, cx| {
|
project.update(cx, |project, cx| {
|
||||||
let tree = project.worktrees(cx).next().unwrap().read(cx);
|
let tree = project.worktrees(cx).next().unwrap().read(cx);
|
||||||
|
@ -3332,7 +3337,7 @@ async fn test_rescan_and_remote_updates(cx: &mut gpui::TestAppContext) {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let project = Project::test(Arc::new(RealFs::default()), [dir.path()], cx).await;
|
let project = Project::test(Arc::new(RealFs::new(None, cx.executor())), [dir.path()], cx).await;
|
||||||
|
|
||||||
let buffer_for_path = |path: &'static str, cx: &mut gpui::TestAppContext| {
|
let buffer_for_path = |path: &'static str, cx: &mut gpui::TestAppContext| {
|
||||||
let buffer = project.update(cx, |p, cx| p.open_local_buffer(dir.path().join(path), cx));
|
let buffer = project.update(cx, |p, cx| p.open_local_buffer(dir.path().join(path), cx));
|
||||||
|
|
|
@ -445,7 +445,7 @@ pub fn execute_run(
|
||||||
let extension_host_proxy = ExtensionHostProxy::global(cx);
|
let extension_host_proxy = ExtensionHostProxy::global(cx);
|
||||||
|
|
||||||
let project = cx.new(|cx| {
|
let project = cx.new(|cx| {
|
||||||
let fs = Arc::new(RealFs::new(None));
|
let fs = Arc::new(RealFs::new(None, cx.background_executor().clone()));
|
||||||
let node_settings_rx = initialize_settings(session.clone(), fs.clone(), cx);
|
let node_settings_rx = initialize_settings(session.clone(), fs.clone(), cx);
|
||||||
|
|
||||||
let proxy_url = read_proxy_settings(cx);
|
let proxy_url = read_proxy_settings(cx);
|
||||||
|
|
|
@ -1035,16 +1035,13 @@ impl Worktree {
|
||||||
Worktree::Local(this) => {
|
Worktree::Local(this) => {
|
||||||
let path = Arc::from(path);
|
let path = Arc::from(path);
|
||||||
let snapshot = this.snapshot();
|
let snapshot = this.snapshot();
|
||||||
cx.spawn(async move |cx| {
|
cx.spawn(async move |_cx| {
|
||||||
if let Some(repo) = snapshot.local_repo_containing_path(&path) {
|
if let Some(repo) = snapshot.local_repo_containing_path(&path) {
|
||||||
if let Some(repo_path) = repo.relativize(&path).log_err() {
|
if let Some(repo_path) = repo.relativize(&path).log_err() {
|
||||||
if let Some(git_repo) =
|
if let Some(git_repo) =
|
||||||
snapshot.git_repositories.get(&repo.work_directory_id)
|
snapshot.git_repositories.get(&repo.work_directory_id)
|
||||||
{
|
{
|
||||||
return Ok(git_repo
|
return Ok(git_repo.repo_ptr.load_index_text(repo_path).await);
|
||||||
.repo_ptr
|
|
||||||
.load_index_text(repo_path, cx.clone())
|
|
||||||
.await);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1062,16 +1059,13 @@ impl Worktree {
|
||||||
Worktree::Local(this) => {
|
Worktree::Local(this) => {
|
||||||
let path = Arc::from(path);
|
let path = Arc::from(path);
|
||||||
let snapshot = this.snapshot();
|
let snapshot = this.snapshot();
|
||||||
cx.spawn(async move |cx| {
|
cx.spawn(async move |_cx| {
|
||||||
if let Some(repo) = snapshot.local_repo_containing_path(&path) {
|
if let Some(repo) = snapshot.local_repo_containing_path(&path) {
|
||||||
if let Some(repo_path) = repo.relativize(&path).log_err() {
|
if let Some(repo_path) = repo.relativize(&path).log_err() {
|
||||||
if let Some(git_repo) =
|
if let Some(git_repo) =
|
||||||
snapshot.git_repositories.get(&repo.work_directory_id)
|
snapshot.git_repositories.get(&repo.work_directory_id)
|
||||||
{
|
{
|
||||||
return Ok(git_repo
|
return Ok(git_repo.repo_ptr.load_committed_text(repo_path).await);
|
||||||
.repo_ptr
|
|
||||||
.load_committed_text(repo_path, cx.clone())
|
|
||||||
.await);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5027,7 +5021,7 @@ impl BackgroundScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (_work_directory, mut paths) in paths_by_git_repo {
|
for (_work_directory, mut paths) in paths_by_git_repo {
|
||||||
if let Ok(status) = paths.repo.status(&paths.repo_paths) {
|
if let Ok(status) = paths.repo.status_blocking(&paths.repo_paths) {
|
||||||
let mut changed_path_statuses = Vec::new();
|
let mut changed_path_statuses = Vec::new();
|
||||||
let statuses = paths.entry.statuses_by_path.clone();
|
let statuses = paths.entry.statuses_by_path.clone();
|
||||||
let mut cursor = statuses.cursor::<PathProgress>(&());
|
let mut cursor = statuses.cursor::<PathProgress>(&());
|
||||||
|
@ -5531,7 +5525,7 @@ async fn do_git_status_update(
|
||||||
log::trace!("updating git statuses for repo {repository_name}");
|
log::trace!("updating git statuses for repo {repository_name}");
|
||||||
let Some(statuses) = local_repository
|
let Some(statuses) = local_repository
|
||||||
.repo()
|
.repo()
|
||||||
.status(&[git::WORK_DIRECTORY_REPO_PATH.clone()])
|
.status_blocking(&[git::WORK_DIRECTORY_REPO_PATH.clone()])
|
||||||
.log_err()
|
.log_err()
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -351,7 +351,7 @@ async fn test_renaming_case_only(cx: &mut TestAppContext) {
|
||||||
const OLD_NAME: &str = "aaa.rs";
|
const OLD_NAME: &str = "aaa.rs";
|
||||||
const NEW_NAME: &str = "AAA.rs";
|
const NEW_NAME: &str = "AAA.rs";
|
||||||
|
|
||||||
let fs = Arc::new(RealFs::default());
|
let fs = Arc::new(RealFs::new(None, cx.executor()));
|
||||||
let temp_root = TempTree::new(json!({
|
let temp_root = TempTree::new(json!({
|
||||||
OLD_NAME: "",
|
OLD_NAME: "",
|
||||||
}));
|
}));
|
||||||
|
@ -876,7 +876,7 @@ async fn test_write_file(cx: &mut TestAppContext) {
|
||||||
let worktree = Worktree::local(
|
let worktree = Worktree::local(
|
||||||
dir.path(),
|
dir.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -965,7 +965,7 @@ async fn test_file_scan_inclusions(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
dir.path(),
|
dir.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -1028,7 +1028,7 @@ async fn test_file_scan_exclusions_overrules_inclusions(cx: &mut TestAppContext)
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
dir.path(),
|
dir.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -1085,7 +1085,7 @@ async fn test_file_scan_inclusions_reindexes_on_setting_change(cx: &mut TestAppC
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
dir.path(),
|
dir.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -1166,7 +1166,7 @@ async fn test_file_scan_exclusions(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
dir.path(),
|
dir.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -1271,7 +1271,7 @@ async fn test_fs_events_in_exclusions(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
dir.path(),
|
dir.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -1382,7 +1382,7 @@ async fn test_fs_events_in_dot_git_worktree(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
dot_git_worktree_dir.clone(),
|
dot_git_worktree_dir.clone(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -1512,7 +1512,7 @@ async fn test_create_dir_all_on_create_entry(cx: &mut TestAppContext) {
|
||||||
assert!(tree.entry_for_path("a/b/").unwrap().is_dir());
|
assert!(tree.entry_for_path("a/b/").unwrap().is_dir());
|
||||||
});
|
});
|
||||||
|
|
||||||
let fs_real = Arc::new(RealFs::default());
|
let fs_real = Arc::new(RealFs::new(None, cx.executor()));
|
||||||
let temp_root = TempTree::new(json!({
|
let temp_root = TempTree::new(json!({
|
||||||
"a": {}
|
"a": {}
|
||||||
}));
|
}));
|
||||||
|
@ -2126,7 +2126,7 @@ async fn test_rename_work_directory(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
root_path,
|
root_path,
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -2233,7 +2233,7 @@ async fn test_file_status(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
root.path(),
|
root.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -2422,7 +2422,7 @@ async fn test_git_repository_status(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
root.path(),
|
root.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -2551,7 +2551,7 @@ async fn test_git_status_postprocessing(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
root.path(),
|
root.path(),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -2619,7 +2619,7 @@ async fn test_repository_subfolder_git_status(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
root.path().join(project_root),
|
root.path().join(project_root),
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
@ -2685,7 +2685,7 @@ async fn test_conflicted_cherry_pick(cx: &mut TestAppContext) {
|
||||||
let tree = Worktree::local(
|
let tree = Worktree::local(
|
||||||
root_path,
|
root_path,
|
||||||
true,
|
true,
|
||||||
Arc::new(RealFs::default()),
|
Arc::new(RealFs::new(None, cx.executor())),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
&mut cx.to_async(),
|
&mut cx.to_async(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -264,7 +264,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
log::info!("Using git binary path: {:?}", git_binary_path);
|
log::info!("Using git binary path: {:?}", git_binary_path);
|
||||||
|
|
||||||
let fs = Arc::new(RealFs::new(git_binary_path));
|
let fs = Arc::new(RealFs::new(git_binary_path, app.background_executor()));
|
||||||
let user_settings_file_rx = watch_config_file(
|
let user_settings_file_rx = watch_config_file(
|
||||||
&app.background_executor(),
|
&app.background_executor(),
|
||||||
fs.clone(),
|
fs.clone(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue