git: Clear set of dirty paths when doing a full status scan (#36181)

Related to #35780 

Release Notes:

- N/A

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
Cole Miller 2025-08-14 13:54:19 -04:00 committed by GitHub
parent 5a9546ff4b
commit 1a169e0b16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2349,7 +2349,7 @@ impl GitStore {
return None; return None;
}; };
let mut paths = vec![]; let mut paths = Vec::new();
// All paths prefixed by a given repo will constitute a continuous range. // All paths prefixed by a given repo will constitute a continuous range.
while let Some(path) = entries.get(ix) while let Some(path) = entries.get(ix)
&& let Some(repo_path) = && let Some(repo_path) =
@ -2358,7 +2358,11 @@ impl GitStore {
paths.push((repo_path, ix)); paths.push((repo_path, ix));
ix += 1; ix += 1;
} }
Some((repo, paths)) if paths.is_empty() {
None
} else {
Some((repo, paths))
}
}); });
tasks.push_back(task); tasks.push_back(task);
} }
@ -4338,7 +4342,8 @@ impl Repository {
bail!("not a local repository") bail!("not a local repository")
}; };
let (snapshot, events) = this let (snapshot, events) = this
.read_with(&mut cx, |this, _| { .update(&mut cx, |this, _| {
this.paths_needing_status_update.clear();
compute_snapshot( compute_snapshot(
this.id, this.id,
this.work_directory_abs_path.clone(), this.work_directory_abs_path.clone(),
@ -4568,6 +4573,9 @@ impl Repository {
}; };
let paths = changed_paths.iter().cloned().collect::<Vec<_>>(); let paths = changed_paths.iter().cloned().collect::<Vec<_>>();
if paths.is_empty() {
return Ok(());
}
let statuses = backend.status(&paths).await?; let statuses = backend.status(&paths).await?;
let changed_path_statuses = cx let changed_path_statuses = cx