mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 18:41:56 +03:00
Fix the new test
This commit is contained in:
parent
cafeba103b
commit
d3ce82e82c
@ -320,7 +320,7 @@ impl Worktree {
|
|||||||
if new_scan_exclude_files != this.snapshot.scan_exclude_files {
|
if new_scan_exclude_files != this.snapshot.scan_exclude_files {
|
||||||
this.snapshot.scan_exclude_files = new_scan_exclude_files;
|
this.snapshot.scan_exclude_files = new_scan_exclude_files;
|
||||||
log::info!(
|
log::info!(
|
||||||
"Re-scanning due to new scan exclude files: {:?}",
|
"Re-scanning directories, new scan exclude files: {:?}",
|
||||||
this.snapshot
|
this.snapshot
|
||||||
.scan_exclude_files
|
.scan_exclude_files
|
||||||
.iter()
|
.iter()
|
||||||
@ -343,7 +343,6 @@ impl Worktree {
|
|||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
this.is_scanning = watch::channel_with(true);
|
this.is_scanning = watch::channel_with(true);
|
||||||
// TODO kb change more state? will this even work now?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -3489,18 +3488,26 @@ impl BackgroundScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn scan_dir(&self, job: &ScanJob) -> Result<()> {
|
async fn scan_dir(&self, job: &ScanJob) -> Result<()> {
|
||||||
log::debug!("scan directory {:?}", job.path);
|
let root_abs_path;
|
||||||
|
let mut ignore_stack;
|
||||||
let mut ignore_stack = job.ignore_stack.clone();
|
let mut new_ignore;
|
||||||
let mut new_ignore = None;
|
let root_char_bag;
|
||||||
let (root_abs_path, root_char_bag, next_entry_id) = {
|
let next_entry_id;
|
||||||
let snapshot = &self.state.lock().snapshot;
|
{
|
||||||
(
|
let state = self.state.lock();
|
||||||
snapshot.abs_path().clone(),
|
let snapshot = &state.snapshot;
|
||||||
snapshot.root_char_bag,
|
root_abs_path = snapshot.abs_path().clone();
|
||||||
self.next_entry_id.clone(),
|
if snapshot.is_abs_path_excluded(&job.abs_path) {
|
||||||
)
|
log::error!("skipping excluded directory {:?}", job.path);
|
||||||
};
|
return Ok(());
|
||||||
|
}
|
||||||
|
log::debug!("scanning directory {:?}", job.path);
|
||||||
|
ignore_stack = job.ignore_stack.clone();
|
||||||
|
new_ignore = None;
|
||||||
|
root_char_bag = snapshot.root_char_bag;
|
||||||
|
next_entry_id = self.next_entry_id.clone();
|
||||||
|
drop(state);
|
||||||
|
}
|
||||||
|
|
||||||
let mut dotgit_path = None;
|
let mut dotgit_path = None;
|
||||||
let mut root_canonical_path = None;
|
let mut root_canonical_path = None;
|
||||||
@ -3515,8 +3522,18 @@ impl BackgroundScanner {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let child_name = child_abs_path.file_name().unwrap();
|
let child_name = child_abs_path.file_name().unwrap();
|
||||||
|
{
|
||||||
|
let mut state = self.state.lock();
|
||||||
|
if state.snapshot.is_abs_path_excluded(&child_abs_path) {
|
||||||
|
let relative_path = job.path.join(child_name);
|
||||||
|
log::debug!("skipping excluded child entry {relative_path:?}");
|
||||||
|
state.remove_path(&relative_path);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
drop(state);
|
||||||
|
}
|
||||||
|
|
||||||
let child_path: Arc<Path> = job.path.join(child_name).into();
|
let child_path: Arc<Path> = job.path.join(child_name).into();
|
||||||
let child_metadata = match self.fs.metadata(&child_abs_path).await {
|
let child_metadata = match self.fs.metadata(&child_abs_path).await {
|
||||||
Ok(Some(metadata)) => metadata,
|
Ok(Some(metadata)) => metadata,
|
||||||
|
@ -935,10 +935,9 @@ async fn test_ignore_exclusions(cx: &mut TestAppContext) {
|
|||||||
&[
|
&[
|
||||||
"src/foo/foo.rs",
|
"src/foo/foo.rs",
|
||||||
"src/foo/another.rs",
|
"src/foo/another.rs",
|
||||||
// TODO kb
|
"node_modules/.DS_Store",
|
||||||
// "node_modules/.DS_Store",
|
"src/.DS_Store",
|
||||||
// "src/.DS_Store",
|
".DS_Store",
|
||||||
// ".DS_Store",
|
|
||||||
],
|
],
|
||||||
&["target/index", "node_modules/prettier/package.json"],
|
&["target/index", "node_modules/prettier/package.json"],
|
||||||
&["src/lib.rs", "src/bar/bar.rs", ".gitignore"],
|
&["src/lib.rs", "src/bar/bar.rs", ".gitignore"],
|
||||||
|
Loading…
Reference in New Issue
Block a user