Load global ignore rules from ~/.config/atomic/ignore
()
| 331 | |
| 332 | /// Load global ignore rules from ~/.config/atomic/ignore |
| 333 | fn load_global_ignore() -> Option<Gitignore> { |
| 334 | let config_dir = atomic_config::global_config_dir()?; |
| 335 | let ignore_path = config_dir.join("ignore"); |
| 336 | |
| 337 | if ignore_path.exists() { |
| 338 | let mut builder = GitignoreBuilder::new(&config_dir); |
| 339 | // builder.add() returns Option<Error> - log if there's an issue |
| 340 | if let Some(err) = builder.add(&ignore_path) { |
| 341 | log::warn!( |
| 342 | "Failed to parse global ignore at {}: {}", |
| 343 | ignore_path.display(), |
| 344 | err |
| 345 | ); |
| 346 | return None; |
| 347 | } |
| 348 | match builder.build() { |
| 349 | Ok(gitignore) => Some(gitignore), |
| 350 | Err(err) => { |
| 351 | log::warn!( |
| 352 | "Failed to build global ignore rules from {}: {}", |
| 353 | ignore_path.display(), |
| 354 | err |
| 355 | ); |
| 356 | None |
| 357 | } |
| 358 | } |
| 359 | } else { |
| 360 | None |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | /// Repository-local ignore files, lowest precedence first. |
| 365 | /// |