Check if a path should be ignored during tracking, with optional ignore rules. This is the full version that accepts optional [`IgnoreRules`] for pattern matching. # Arguments `path` - Path to check (relative to repository root) `include_hidden` - Whether to include hidden files (starting with '.') `is_dir` - Whether the path is a directory `rules` - Optional ignore rules from `.atomicignore` f
(
path: &Path,
include_hidden: bool,
is_dir: bool,
rules: Option<&IgnoreRules>,
)
| 129 | /// |
| 130 | /// `true` if the path should be ignored, `false` otherwise. |
| 131 | pub fn should_ignore_with_rules( |
| 132 | path: &Path, |
| 133 | include_hidden: bool, |
| 134 | is_dir: bool, |
| 135 | rules: Option<&IgnoreRules>, |
| 136 | ) -> bool { |
| 137 | // Always ignore internal directories |
| 138 | if is_always_ignored(path) { |
| 139 | return true; |
| 140 | } |
| 141 | |
| 142 | // Check ignore rules if provided |
| 143 | if let Some(rules) = rules { |
| 144 | if rules.is_ignored(path, is_dir) { |
| 145 | return true; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // Check for hidden files |
| 150 | if !include_hidden { |
| 151 | if let Some(name) = path.file_name() { |
| 152 | if let Some(name_str) = name.to_str() { |
| 153 | if name_str.starts_with('.') { |
| 154 | return true; |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | false |
| 161 | } |
| 162 | |
| 163 | /// Collect all files in a directory for tracking. |
| 164 | /// |
no test coverage detected