Print debug information about ignore rules.
(
&self,
repo: &Repository,
working_copy: atomic_core::WorkingCopyId,
)
| 643 | impl Status { |
| 644 | /// Print debug information about ignore rules. |
| 645 | fn print_ignore_debug( |
| 646 | &self, |
| 647 | repo: &Repository, |
| 648 | working_copy: atomic_core::WorkingCopyId, |
| 649 | ) -> CliResult<()> { |
| 650 | use std::path::Path; |
| 651 | |
| 652 | println!("=== Ignore Debug Information ==="); |
| 653 | println!("Repository root: {}", repo.root().display()); |
| 654 | |
| 655 | let ignore_path = repo.root().join(".atomicignore"); |
| 656 | println!(".atomicignore path: {}", ignore_path.display()); |
| 657 | println!(".atomicignore exists: {}", ignore_path.exists()); |
| 658 | |
| 659 | if ignore_path.exists() { |
| 660 | if let Ok(content) = std::fs::read_to_string(&ignore_path) { |
| 661 | println!(".atomicignore content ({} bytes):", content.len()); |
| 662 | for (i, line) in content.lines().enumerate() { |
| 663 | println!(" {}: {:?}", i + 1, line); |
| 664 | } |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | let rules = repo |
| 669 | .ignore_rules(working_copy) |
| 670 | .map_err(|e| CliError::InvalidRepository { |
| 671 | reason: e.to_string(), |
| 672 | })?; |
| 673 | println!("\nIgnore rules loaded:"); |
| 674 | println!(" Has local rules: {}", rules.has_local_rules()); |
| 675 | println!(" Has global rules: {}", rules.has_global_rules()); |
| 676 | println!(" Local pattern count: {}", rules.local_pattern_count()); |
| 677 | println!(" Global pattern count: {}", rules.global_pattern_count()); |
| 678 | |
| 679 | // Test some common paths |
| 680 | let test_paths = [ |
| 681 | ("node_modules", true), |
| 682 | ("node_modules/foo", true), |
| 683 | ("node_modules/foo/bar.js", false), |
| 684 | ("target", true), |
| 685 | ("target/debug", true), |
| 686 | ("src/main.rs", false), |
| 687 | ]; |
| 688 | |
| 689 | println!("\nTest path matching:"); |
| 690 | for (path, is_dir) in test_paths { |
| 691 | let ignored = rules.is_ignored(Path::new(path), is_dir); |
| 692 | println!(" {:40} is_dir={:5} ignored={}", path, is_dir, ignored); |
| 693 | } |
| 694 | |
| 695 | println!("================================\n"); |
| 696 | Ok(()) |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | impl Command for Status { |
no test coverage detected