Backport git store bugfix to v0.182.x (#28593)

Cole Miller created

Closes #ISSUE

Release Notes:

- Fixed a bug that could cause the staged status of entries in the git
panel to be stale.

Change summary

crates/project/src/git_store.rs                 |  6 ------
crates/project_panel/src/project_panel_tests.rs | 14 ++++++++++++++
2 files changed, 14 insertions(+), 6 deletions(-)

Detailed changes

crates/project/src/git_store.rs 🔗

@@ -3717,12 +3717,6 @@ impl Repository {
         updates_tx: Option<mpsc::UnboundedSender<DownstreamUpdate>>,
         cx: &mut Context<Self>,
     ) {
-        self.paths_changed(
-            vec![git::repository::WORK_DIRECTORY_REPO_PATH.clone()],
-            updates_tx.clone(),
-            cx,
-        );
-
         let this = cx.weak_entity();
         let _ = self.send_keyed_job(
             Some(GitJobKey::ReloadGitState),

crates/project_panel/src/project_panel_tests.rs 🔗

@@ -2070,6 +2070,20 @@ async fn test_select_git_entry(cx: &mut gpui::TestAppContext) {
         cx,
     )
     .await;
+
+    let (scan1_complete, scan2_complete) = project.update(cx, |project, cx| {
+        let mut worktrees = project.worktrees(cx);
+        let worktree1 = worktrees.next().unwrap();
+        let worktree2 = worktrees.next().unwrap();
+        (
+            worktree1.read(cx).as_local().unwrap().scan_complete(),
+            worktree2.read(cx).as_local().unwrap().scan_complete(),
+        )
+    });
+    scan1_complete.await;
+    scan2_complete.await;
+    cx.run_until_parked();
+
     let workspace = cx.add_window(|window, cx| Workspace::test_new(project.clone(), window, cx));
     let cx = &mut VisualTestContext::from_window(*workspace, cx);
     let panel = workspace.update(cx, ProjectPanel::new).unwrap();