260717.6 · b621e65b4fc8a50b55576b07526f21c5d051ad71
ignore: add incremental checking
This adds a new increment checker for ignore files, overrides and file type selection. This effectively makes it possible to check individual file paths as to whether they are ignored or not by any ignore file in the directory tree (including parent gitignores). This is particularly useful in the context of implementing a file watcher, where one wants to make a decision about whether a newly added file should be included *without* doing a full re-traversal of the directory tree.
This implementation reuses pretty much all of the existing gitignore logic without making any changes to it.
reading declarations
Changes to crates/ignore/src/lib.rs. All files
@@ -48,6 +48,7 @@ See the documentation for `WalkBuilder` for many other options. use std::path::{Path, PathBuf}; +pub use crate::incremental::{IncrementalIgnore, IncrementalMatch}; pub use crate::walk::{ DirEntry, ParallelVisitor, ParallelVisitorBuilder, Walk, WalkBuilder, WalkParallel, WalkState,@@ -56,6 +57,7 @@ pub use crate::walk::{ mod default_types; mod dir; pub mod gitignore;+mod incremental; pub mod overrides; mod pathutil; pub mod types;