Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Don't watch parent directory of global gitexcludes file (#48408)

Conrad Irwin2cecdab47d52
diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs
index 39d8f59d87b..8487b60690b 100644
--- a/crates/editor/src/editor_tests.rs
+++ b/crates/editor/src/editor_tests.rs
@@ -7853,6 +7853,7 @@ async fn test_paste_content_from_other_app(cx: &mut TestAppContext) {
let mut cx = EditorTestContext::new(cx).await;
cx.update_buffer(|buffer, cx| buffer.set_language(Some(rust_lang()), cx));
+ cx.run_until_parked();
cx.set_state(indoc! {"
fn a() {
@@ -22342,6 +22343,7 @@ async fn test_active_indent_guide_respect_indented_range(cx: &mut TestAppContext
s.select_ranges([Point::new(1, 0)..Point::new(1, 0)])
});
});
+ cx.run_until_parked();
assert_indent_guides(
0..4,
@@ -22358,6 +22360,7 @@ async fn test_active_indent_guide_respect_indented_range(cx: &mut TestAppContext
s.select_ranges([Point::new(2, 0)..Point::new(2, 0)])
});
});
+ cx.run_until_parked();
assert_indent_guides(
0..4,
@@ -22374,6 +22377,7 @@ async fn test_active_indent_guide_respect_indented_range(cx: &mut TestAppContext
s.select_ranges([Point::new(3, 0)..Point::new(3, 0)])
});
});
+ cx.run_until_parked();
assert_indent_guides(
0..4,
diff --git a/crates/file_finder/src/file_finder_tests.rs b/crates/file_finder/src/file_finder_tests.rs
index e8d85921a18..1b1421e8b89 100644
--- a/crates/file_finder/src/file_finder_tests.rs
+++ b/crates/file_finder/src/file_finder_tests.rs
@@ -2831,8 +2831,10 @@ async fn test_selected_match_stays_selected_after_matches_refreshed(cx: &mut gpu
.create_file(Path::new(&filename), Default::default())
.await
.expect("unable to create file");
+ // Wait for each file system event to be fully processed before adding the next
+ cx.executor().advance_clock(FS_WATCH_LATENCY);
+ cx.run_until_parked();
}
- cx.executor().advance_clock(FS_WATCH_LATENCY);
// file_13.txt is still selected
picker.update(cx, |finder, _| {
diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs
index fd8aa464060..77a9f48f333 100644
--- a/crates/worktree/src/worktree.rs
+++ b/crates/worktree/src/worktree.rs
@@ -3800,8 +3800,9 @@ impl BackgroundScanner {
log::trace!("containing git repository: {containing_git_repository:?}");
+ let global_gitignore_file = paths::global_gitignore_path();
let mut global_gitignore_events = if let Some(global_gitignore_path) =
- &paths::global_gitignore_path()
+ &global_gitignore_file
&& scanning_enabled
{
let is_file = self.fs.is_file(&global_gitignore_path).await;
@@ -3813,9 +3814,7 @@ impl BackgroundScanner {
} else {
None
};
- if is_file
- || matches!(global_gitignore_path.parent(), Some(path) if self.fs.is_dir(path).await)
- {
+ if is_file {
self.fs
.watch(global_gitignore_path, FS_WATCH_LATENCY)
.await
@@ -3931,12 +3930,9 @@ impl BackgroundScanner {
self.process_events(paths.into_iter().filter(|e| e.kind.is_some()).map(Into::into).collect()).await;
}
- paths = global_gitignore_events.next().fuse() => {
- match paths.as_deref() {
- Some([event, ..]) => {
- self.update_global_gitignore(&event.path).await;
- }
- _ => (),
+ _ = global_gitignore_events.next().fuse() => {
+ if let Some(path) = &global_gitignore_file {
+ self.update_global_gitignore(&path).await;
}
}
}