worktree: Don't attempt to watch non-existing global gitignore (#40476)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-10-17 13:19:38 +00:00
committed by GitHub
parent 9056d77604
commit b27fd3b8d7
2 changed files with 22 additions and 16 deletions
@@ -164,7 +164,6 @@ pub struct BreakpointStore {
impl BreakpointStore {
pub fn init(client: &AnyProtoClient) {
log::error!("breakpoint store init");
client.add_entity_request_handler(Self::handle_toggle_breakpoint);
client.add_entity_message_handler(Self::handle_breakpoints_for_file);
}
+22 -15
View File
@@ -3614,25 +3614,32 @@ impl BackgroundScanner {
log::trace!("containing git repository: {containing_git_repository:?}");
let mut global_gitignore_events =
if let Some(global_gitignore_path) = &paths::global_gitignore_path() {
self.state.lock().await.snapshot.global_gitignore =
if self.fs.is_file(&global_gitignore_path).await {
build_gitignore(global_gitignore_path, self.fs.as_ref())
.await
.ok()
.map(Arc::new)
} else {
None
};
let mut global_gitignore_events = if let Some(global_gitignore_path) =
&paths::global_gitignore_path()
{
let is_file = self.fs.is_file(&global_gitignore_path).await;
self.state.lock().await.snapshot.global_gitignore = if is_file {
build_gitignore(global_gitignore_path, self.fs.as_ref())
.await
.ok()
.map(Arc::new)
} else {
None
};
if is_file
|| matches!(global_gitignore_path.parent(), Some(path) if self.fs.is_dir(path).await)
{
self.fs
.watch(global_gitignore_path, FS_WATCH_LATENCY)
.await
.0
} else {
self.state.lock().await.snapshot.global_gitignore = None;
Box::pin(futures::stream::empty())
};
Box::pin(futures::stream::pending())
}
} else {
self.state.lock().await.snapshot.global_gitignore = None;
Box::pin(futures::stream::pending())
};
let (scan_job_tx, scan_job_rx) = channel::unbounded();
{
@@ -3740,7 +3747,7 @@ impl BackgroundScanner {
Some([event, ..]) => {
self.update_global_gitignore(&event.path).await;
}
_ => {},
_ => (),
}
}
}