From 1a169e0b16801b278140bb9a59fa45ab56644f4d Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Thu, 14 Aug 2025 13:54:19 -0400 Subject: [PATCH] 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 --- crates/project/src/git_store.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index 32deb0dbc4..3163a10239 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -2349,7 +2349,7 @@ impl GitStore { return None; }; - let mut paths = vec![]; + let mut paths = Vec::new(); // All paths prefixed by a given repo will constitute a continuous range. while let Some(path) = entries.get(ix) && let Some(repo_path) = @@ -2358,7 +2358,11 @@ impl GitStore { paths.push((repo_path, ix)); ix += 1; } - Some((repo, paths)) + if paths.is_empty() { + None + } else { + Some((repo, paths)) + } }); tasks.push_back(task); } @@ -4338,7 +4342,8 @@ impl Repository { bail!("not a local repository") }; let (snapshot, events) = this - .read_with(&mut cx, |this, _| { + .update(&mut cx, |this, _| { + this.paths_needing_status_update.clear(); compute_snapshot( this.id, this.work_directory_abs_path.clone(), @@ -4568,6 +4573,9 @@ impl Repository { }; let paths = changed_paths.iter().cloned().collect::>(); + if paths.is_empty() { + return Ok(()); + } let statuses = backend.status(&paths).await?; let changed_path_statuses = cx