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

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>
This commit is contained in:
Michael Sloan 2025-08-27 18:34:14 -06:00 committed by GitHub
parent b233df8343
commit 8af212e785
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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