Check if a path should be ignored. This checks both local and global rules. Local rules take precedence. Whitelist patterns (`!pattern`) can un-ignore files. # Arguments `path` - The path to check (relative to repository root) `is_dir` - Whether the path is a directory # Returns `true` if the path should be ignored, `false` otherwise.
(&self, path: &Path, is_dir: bool)
| 201 | /// |
| 202 | /// `true` if the path should be ignored, `false` otherwise. |
| 203 | pub fn is_ignored(&self, path: &Path, is_dir: bool) -> bool { |
| 204 | // Check local rules first (higher priority) |
| 205 | if let Some(ref local) = self.local { |
| 206 | match local.matched_path_or_any_parents(path, is_dir) { |
| 207 | ignore::Match::Ignore(_) => return true, |
| 208 | ignore::Match::Whitelist(_) => return false, |
| 209 | ignore::Match::None => {} |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | // Then check global rules |
| 214 | if let Some(ref global) = self.global { |
| 215 | match global.matched_path_or_any_parents(path, is_dir) { |
| 216 | ignore::Match::Ignore(_) => return true, |
| 217 | ignore::Match::Whitelist(_) => return false, |
| 218 | ignore::Match::None => {} |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | false |
| 223 | } |
| 224 | |
| 225 | /// Check if a path should be ignored, using absolute path. |
| 226 | /// |