Fix fifo files hanging the project wide search (#16039)

Release Notes:

- Fixed the issue related to the project wide search being stuck when
project contains .fifo files
- Might potentially solve the following issue
https://github.com/zed-industries/zed/issues/7360
This commit is contained in:
TheCub3 2024-08-26 21:40:20 +05:00 committed by GitHub
parent aaddb73b28
commit 2f08a0a28c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 34 additions and 3 deletions

View file

@ -9,6 +9,9 @@ use std::{fs::File, os::fd::AsFd};
#[cfg(unix)]
use std::os::unix::fs::MetadataExt;
#[cfg(unix)]
use std::os::unix::fs::FileTypeExt;
use async_tar::Archive;
use futures::{future::BoxFuture, AsyncRead, Stream, StreamExt};
use git::repository::{GitRepository, RealGitRepository};
@ -149,6 +152,7 @@ pub struct Metadata {
pub mtime: SystemTime,
pub is_symlink: bool,
pub is_dir: bool,
pub is_fifo: bool,
}
#[derive(Default)]
@ -428,11 +432,18 @@ impl Fs for RealFs {
#[cfg(windows)]
let inode = file_id(path).await?;
#[cfg(windows)]
let is_fifo = false;
#[cfg(unix)]
let is_fifo = metadata.file_type().is_fifo();
Ok(Some(Metadata {
inode,
mtime: metadata.modified().unwrap(),
is_symlink,
is_dir: metadata.file_type().is_dir(),
is_fifo,
}))
}
@ -1537,12 +1548,14 @@ impl Fs for FakeFs {
mtime: *mtime,
is_dir: false,
is_symlink,
is_fifo: false,
},
FakeFsEntry::Dir { inode, mtime, .. } => Metadata {
inode: *inode,
mtime: *mtime,
is_dir: true,
is_symlink,
is_fifo: false,
},
FakeFsEntry::Symlink { .. } => unreachable!(),
}))