B:BD[
4.1016] → [
4.1016:1110]
∅:D[
4.1110] → [
3.209107:209110]
B:BD[
3.209107] → [
3.209107:209110]
B:BD[
3.209110] → [
4.1111:1397]
pub fn ignore_filter(entry: &ignore::DirEntry) -> bool {
ignore_filter_path(entry.path())
}
pub fn ignore_filter_path(path: &std::path::Path) -> bool {
debug!("ignore_filter_path {:?}", path);
if let Some(file) = path.file_name() {
if let Some(file) = file.to_str() {
!file.ends_with("~") && !file.starts_with("#")
} else {
false
pub fn filter_ignore(root_: &CanonicalPath, path: &CanonicalPath, is_dir: bool) -> bool {
debug!("path = {:?} root = {:?}", path, root_);
if let Ok(suffix) = path.as_path().strip_prefix(root_.as_path()) {
debug!("suffix = {:?}", suffix);
let mut root = root_.as_path().to_path_buf();
let mut ignore = ignore::gitignore::GitignoreBuilder::new(&root);
let mut add_root = |root: &mut PathBuf| {
root.push(".ignore");
ignore.add(&root);
root.pop();
root.push(".gitignore");
ignore.add(&root);
root.pop();
};
add_root(&mut root);
for c in suffix.components() {
root.push(c);
add_root(&mut root);
}
if let Ok(ig) = ignore.build() {
let m = ig.matched(suffix, is_dir);
debug!("m = {:?}", m);
return !m.is_ignore();