Fix watching of Git repo in presence of scanner restarts (#37052)

Michael Sloan and Julia created

The scanner is restarted after loading initial settings, and there was
an optimization to not re-discover and re-watch git repositories if they
already exist in the snapshot. #35865 added cleanup of watches that
occurred when the scanner restarts, and so in some cases repos were no
longer watched.

Release Notes:

- Linux: Fixed a case where Git repositories might not be watched for
changes, causing branch switching to not update the UI.

Co-authored-by: Julia <julia@zed.dev>

Change summary

crates/worktree/src/worktree.rs | 10 ----------
1 file changed, 10 deletions(-)

Detailed changes

crates/worktree/src/worktree.rs 🔗

@@ -3151,16 +3151,6 @@ impl BackgroundScannerState {
             .work_directory_abs_path(&work_directory)
             .log_err()?;
 
-        if self
-            .snapshot
-            .git_repositories
-            .get(&work_dir_entry.id)
-            .is_some()
-        {
-            log::trace!("existing git repository for {work_directory:?}");
-            return None;
-        }
-
         let dot_git_abs_path: Arc<Path> = self
             .snapshot
             .abs_path