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

@ -1035,16 +1035,13 @@ impl Worktree {
Worktree::Local(this) => {
let path = Arc::from(path);
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_path) = repo.relativize(&path).log_err() {
if let Some(git_repo) =
snapshot.git_repositories.get(&repo.work_directory_id)
{
return Ok(git_repo
.repo_ptr
.load_index_text(repo_path, cx.clone())
.await);
return Ok(git_repo.repo_ptr.load_index_text(repo_path).await);
}
}
}
@ -1062,16 +1059,13 @@ impl Worktree {
Worktree::Local(this) => {
let path = Arc::from(path);
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_path) = repo.relativize(&path).log_err() {
if let Some(git_repo) =
snapshot.git_repositories.get(&repo.work_directory_id)
{
return Ok(git_repo
.repo_ptr
.load_committed_text(repo_path, cx.clone())
.await);
return Ok(git_repo.repo_ptr.load_committed_text(repo_path).await);
}
}
}
@ -5027,7 +5021,7 @@ impl BackgroundScanner {
}
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 statuses = paths.entry.statuses_by_path.clone();
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}");
let Some(statuses) = local_repository
.repo()
.status(&[git::WORK_DIRECTORY_REPO_PATH.clone()])
.status_blocking(&[git::WORK_DIRECTORY_REPO_PATH.clone()])
.log_err()
else {
return;