Print debug information about ignore rules.
(&self, repo: &Repository)
| 428 | impl Status { |
| 429 | /// Print debug information about ignore rules. |
| 430 | fn print_ignore_debug(&self, repo: &Repository) -> CliResult<()> { |
| 431 | use std::path::Path; |
| 432 | |
| 433 | println!("=== Ignore Debug Information ==="); |
| 434 | println!("Repository root: {}", repo.root().display()); |
| 435 | |
| 436 | let ignore_path = repo.root().join(".atomicignore"); |
| 437 | println!(".atomicignore path: {}", ignore_path.display()); |
| 438 | println!(".atomicignore exists: {}", ignore_path.exists()); |
| 439 | |
| 440 | if ignore_path.exists() { |
| 441 | if let Ok(content) = std::fs::read_to_string(&ignore_path) { |
| 442 | println!(".atomicignore content ({} bytes):", content.len()); |
| 443 | for (i, line) in content.lines().enumerate() { |
| 444 | println!(" {}: {:?}", i + 1, line); |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | let rules = repo.ignore_rules(); |
| 450 | println!("\nIgnore rules loaded:"); |
| 451 | println!(" Has local rules: {}", rules.has_local_rules()); |
| 452 | println!(" Has global rules: {}", rules.has_global_rules()); |
| 453 | println!(" Local pattern count: {}", rules.local_pattern_count()); |
| 454 | println!(" Global pattern count: {}", rules.global_pattern_count()); |
| 455 | |
| 456 | // Test some common paths |
| 457 | let test_paths = [ |
| 458 | ("node_modules", true), |
| 459 | ("node_modules/foo", true), |
| 460 | ("node_modules/foo/bar.js", false), |
| 461 | ("target", true), |
| 462 | ("target/debug", true), |
| 463 | ("src/main.rs", false), |
| 464 | ]; |
| 465 | |
| 466 | println!("\nTest path matching:"); |
| 467 | for (path, is_dir) in test_paths { |
| 468 | let ignored = rules.is_ignored(Path::new(path), is_dir); |
| 469 | println!(" {:40} is_dir={:5} ignored={}", path, is_dir, ignored); |
| 470 | } |
| 471 | |
| 472 | println!("================================\n"); |
| 473 | Ok(()) |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | impl Command for Status { |
no test coverage detected