Fix collab tests
This commit is contained in:
parent
95a413847a
commit
31a4acf98a
1 changed files with 32 additions and 25 deletions
|
@ -2400,11 +2400,6 @@ impl BackgroundScannerState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reload_repositories(&mut self, dot_git_dirs_to_reload: &HashSet<PathBuf>, fs: &dyn Fs) {
|
fn reload_repositories(&mut self, dot_git_dirs_to_reload: &HashSet<PathBuf>, fs: &dyn Fs) {
|
||||||
if dot_git_dirs_to_reload.is_empty() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
log::debug!("reloading repositories: {dot_git_dirs_to_reload:?}");
|
|
||||||
let scan_id = self.snapshot.scan_id;
|
let scan_id = self.snapshot.scan_id;
|
||||||
for dot_git_dir in dot_git_dirs_to_reload {
|
for dot_git_dir in dot_git_dirs_to_reload {
|
||||||
// If there is already a repository for this .git directory, reload
|
// If there is already a repository for this .git directory, reload
|
||||||
|
@ -3310,16 +3305,18 @@ impl BackgroundScanner {
|
||||||
abs_paths.retain(|abs_path| {
|
abs_paths.retain(|abs_path| {
|
||||||
let snapshot = &self.state.lock().snapshot;
|
let snapshot = &self.state.lock().snapshot;
|
||||||
{
|
{
|
||||||
|
let mut is_git_related = false;
|
||||||
if let Some(dot_git_dir) = abs_path
|
if let Some(dot_git_dir) = abs_path
|
||||||
.ancestors()
|
.ancestors()
|
||||||
.find(|ancestor| ancestor.file_name() == Some(&*DOT_GIT))
|
.find(|ancestor| ancestor.file_name() == Some(&*DOT_GIT))
|
||||||
{
|
{
|
||||||
let dog_git_path = dot_git_dir
|
let dot_git_path = dot_git_dir
|
||||||
.strip_prefix(&root_canonical_path)
|
.strip_prefix(&root_canonical_path)
|
||||||
.ok()
|
.ok()
|
||||||
.map(|path| path.to_path_buf())
|
.map(|path| path.to_path_buf())
|
||||||
.unwrap_or_else(|| dot_git_dir.to_path_buf());
|
.unwrap_or_else(|| dot_git_dir.to_path_buf());
|
||||||
dot_git_paths_to_reload.insert(dog_git_path.to_path_buf());
|
dot_git_paths_to_reload.insert(dot_git_path.to_path_buf());
|
||||||
|
is_git_related = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let relative_path: Arc<Path> =
|
let relative_path: Arc<Path> =
|
||||||
|
@ -3351,7 +3348,9 @@ impl BackgroundScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if excluded_file_event {
|
if excluded_file_event {
|
||||||
log::debug!("ignoring FS event for excluded path {relative_path:?}");
|
if !is_git_related {
|
||||||
|
log::debug!("ignoring FS event for excluded path {relative_path:?}");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3360,31 +3359,39 @@ impl BackgroundScanner {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if relative_paths.is_empty() {
|
if dot_git_paths_to_reload.is_empty() && relative_paths.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log::debug!("received fs events {:?}", relative_paths);
|
if !relative_paths.is_empty() {
|
||||||
|
log::debug!("received fs events {:?}", relative_paths);
|
||||||
|
|
||||||
let (scan_job_tx, scan_job_rx) = channel::unbounded();
|
let (scan_job_tx, scan_job_rx) = channel::unbounded();
|
||||||
self.reload_entries_for_paths(
|
self.reload_entries_for_paths(
|
||||||
root_path,
|
root_path,
|
||||||
root_canonical_path,
|
root_canonical_path,
|
||||||
&relative_paths,
|
&relative_paths,
|
||||||
abs_paths,
|
abs_paths,
|
||||||
Some(scan_job_tx.clone()),
|
Some(scan_job_tx.clone()),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
drop(scan_job_tx);
|
drop(scan_job_tx);
|
||||||
self.scan_dirs(false, scan_job_rx).await;
|
self.scan_dirs(false, scan_job_rx).await;
|
||||||
|
|
||||||
let (scan_job_tx, scan_job_rx) = channel::unbounded();
|
let (scan_job_tx, scan_job_rx) = channel::unbounded();
|
||||||
self.update_ignore_statuses(scan_job_tx).await;
|
self.update_ignore_statuses(scan_job_tx).await;
|
||||||
self.scan_dirs(false, scan_job_rx).await;
|
self.scan_dirs(false, scan_job_rx).await;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut state = self.state.lock();
|
let mut state = self.state.lock();
|
||||||
state.reload_repositories(&dot_git_paths_to_reload, self.fs.as_ref());
|
if !dot_git_paths_to_reload.is_empty() {
|
||||||
|
if relative_paths.is_empty() {
|
||||||
|
state.snapshot.scan_id += 1;
|
||||||
|
}
|
||||||
|
log::debug!("reloading repositories: {dot_git_paths_to_reload:?}");
|
||||||
|
state.reload_repositories(&dot_git_paths_to_reload, self.fs.as_ref());
|
||||||
|
}
|
||||||
state.snapshot.completed_scan_id = state.snapshot.scan_id;
|
state.snapshot.completed_scan_id = state.snapshot.scan_id;
|
||||||
for (_, entry_id) in mem::take(&mut state.removed_entry_ids) {
|
for (_, entry_id) in mem::take(&mut state.removed_entry_ids) {
|
||||||
state.scanned_dirs.remove(&entry_id);
|
state.scanned_dirs.remove(&entry_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue