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:
Antonio Scandurra 2025-03-27 10:05:54 +01:00 committed by GitHub
parent 926d10cc45
commit 7354ef91e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 662 additions and 716 deletions

View file

@ -8,6 +8,7 @@ use anyhow::{anyhow, Context as _, Result};
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
use ashpd::desktop::trash;
use gpui::App;
use gpui::BackgroundExecutor;
use gpui::Global;
use gpui::ReadGlobal as _;
use std::borrow::Cow;
@ -240,9 +241,9 @@ impl From<MTime> for proto::Timestamp {
}
}
#[derive(Default)]
pub struct RealFs {
git_binary_path: Option<PathBuf>,
executor: BackgroundExecutor,
}
pub trait FileHandle: Send + Sync + std::fmt::Debug {
@ -294,8 +295,11 @@ impl FileHandle for std::fs::File {
pub struct RealWatcher {}
impl RealFs {
pub fn new(git_binary_path: Option<PathBuf>) -> Self {
Self { git_binary_path }
pub fn new(git_binary_path: Option<PathBuf>, executor: BackgroundExecutor) -> Self {
Self {
git_binary_path,
executor,
}
}
}
@ -754,6 +758,7 @@ impl Fs for RealFs {
Some(Arc::new(RealGitRepository::new(
dotgit_path,
self.git_binary_path.clone(),
self.executor.clone(),
)?))
}