Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo 2021-04-20 10:59:12 -06:00
parent 9899614f31
commit 5cbbf620ed

View file

@ -5,7 +5,7 @@ use crate::{
editor::{History, Snapshot as BufferSnapshot},
sum_tree::{self, Edit, SumTree},
};
use anyhow::{anyhow, Result};
use anyhow::{anyhow, Context, Result};
use fuzzy::PathEntry;
pub use fuzzy::{match_paths, PathMatch};
use gpui::{scoped_pool, AppContext, Entity, ModelContext, ModelHandle, Task};
@ -781,11 +781,18 @@ impl BackgroundScanner {
let is_ignored = ignore.matched(&path, metadata.is_dir()).is_ignore();
let inode = metadata.ino();
let is_symlink = fs::symlink_metadata(&path)?.file_type().is_symlink();
let is_symlink = fs::symlink_metadata(&path)
.context("symlink_metadata")?
.file_type()
.is_symlink();
let parent = if path == root_path {
None
} else {
Some(fs::metadata(path.parent().unwrap())?.ino())
Some(
fs::metadata(path.parent().unwrap())
.context("parent metadata")?
.ino(),
)
};
if metadata.file_type().is_dir() {
Ok(Some((
@ -819,10 +826,11 @@ impl BackgroundScanner {
}
}
Err(err) => {
dbg!(&err);
if err.kind() == io::ErrorKind::NotFound {
Ok(None)
} else {
Err(anyhow::Error::new(err))
Err(anyhow::Error::new(err)).context("fs::metadata")
}
}
}