Print debug information about ignore rules.
(&self, repo: &Repository)
| 453 | impl Status { |
| 454 | /// Print debug information about ignore rules. |
| 455 | fn print_ignore_debug(&self, repo: &Repository) -> CliResult<()> { |
| 456 | use std::path::Path; |
| 457 | |
| 458 | println!("=== Ignore Debug Information ==="); |
| 459 | println!("Repository root: {}", repo.root().display()); |
| 460 | |
| 461 | let ignore_path = repo.root().join(".atomicignore"); |
| 462 | println!(".atomicignore path: {}", ignore_path.display()); |
| 463 | println!(".atomicignore exists: {}", ignore_path.exists()); |
| 464 | |
| 465 | if ignore_path.exists() { |
| 466 | if let Ok(content) = std::fs::read_to_string(&ignore_path) { |
| 467 | println!(".atomicignore content ({} bytes):", content.len()); |
| 468 | for (i, line) in content.lines().enumerate() { |
| 469 | println!(" {}: {:?}", i + 1, line); |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | let rules = repo.ignore_rules(); |
| 475 | println!("\nIgnore rules loaded:"); |
| 476 | println!(" Has local rules: {}", rules.has_local_rules()); |
| 477 | println!(" Has global rules: {}", rules.has_global_rules()); |
| 478 | println!(" Local pattern count: {}", rules.local_pattern_count()); |
| 479 | println!(" Global pattern count: {}", rules.global_pattern_count()); |
| 480 | |
| 481 | // Test some common paths |
| 482 | let test_paths = [ |
| 483 | ("node_modules", true), |
| 484 | ("node_modules/foo", true), |
| 485 | ("node_modules/foo/bar.js", false), |
| 486 | ("target", true), |
| 487 | ("target/debug", true), |
| 488 | ("src/main.rs", false), |
| 489 | ]; |
| 490 | |
| 491 | println!("\nTest path matching:"); |
| 492 | for (path, is_dir) in test_paths { |
| 493 | let ignored = rules.is_ignored(Path::new(path), is_dir); |
| 494 | println!(" {:40} is_dir={:5} ignored={}", path, is_dir, ignored); |
| 495 | } |
| 496 | |
| 497 | println!("================================\n"); |
| 498 | Ok(()) |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | impl Command for Status { |
no test coverage detected