Don't watch parent directory of global gitexcludes file (#48408)
Closes: #48560 Release Notes: - Fixed an issue where Zed would try to open all edited files in ~ if your git config had a globalexludes in ~ that did not exist. --------- Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
1 parent
c7fea4876d
commit
04ced45004
3 files changed
+13
-11
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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, _| {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user