MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / print_ignore_debug

Method print_ignore_debug

atomic-cli/src/commands/status.rs:645–697  ·  view source on GitHub ↗

Print debug information about ignore rules.

(
        &self,
        repo: &Repository,
        working_copy: atomic_core::WorkingCopyId,
    )

Source from the content-addressed store, hash-verified

643impl 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
700impl Command for Status {

Callers 1

runMethod · 0.80

Calls 5

rootMethod · 0.45
existsMethod · 0.45
linesMethod · 0.45
ignore_rulesMethod · 0.45
is_ignoredMethod · 0.45

Tested by

no test coverage detected