Load repository-local ignore rules from .atomicignore
(repo_root: &Path)
| 336 | |
| 337 | /// Load repository-local ignore rules from .atomicignore |
| 338 | fn load_local_ignore(repo_root: &Path) -> Option<Gitignore> { |
| 339 | let ignore_path = repo_root.join(".atomicignore"); |
| 340 | |
| 341 | if ignore_path.exists() { |
| 342 | let mut builder = GitignoreBuilder::new(repo_root); |
| 343 | // builder.add() returns Option<Error> - log if there's an issue |
| 344 | if let Some(err) = builder.add(&ignore_path) { |
| 345 | log::warn!( |
| 346 | "Failed to parse .atomicignore at {}: {}", |
| 347 | ignore_path.display(), |
| 348 | err |
| 349 | ); |
| 350 | return None; |
| 351 | } |
| 352 | match builder.build() { |
| 353 | Ok(gitignore) => Some(gitignore), |
| 354 | Err(err) => { |
| 355 | log::warn!( |
| 356 | "Failed to build ignore rules from {}: {}", |
| 357 | ignore_path.display(), |
| 358 | err |
| 359 | ); |
| 360 | None |
| 361 | } |
| 362 | } |
| 363 | } else { |
| 364 | None |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | /// Get the path to the global ignore file. |
| 369 | pub fn global_ignore_path() -> Option<std::path::PathBuf> { |