Skip to content

Conversation

@dchristle
Copy link
Contributor

Problem: The -i/--include flag didn't work for file types that failed source detection (e.g., glimpse . -i "*.peb" returned zero files even when .peb files existed).

Root Cause: source_detection::is_source_file() filtered out files before include patterns were evaluated, making it impossible to include non-source file types.

Solution: Refactored filtering logic to make include patterns additive to source detection, matching the CLI help text ("Additional patterns to include"). Files are now included if they match either source detection OR include patterns, then exclude patterns are applied to the union.

Changes:

  • Centralized filtering logic in should_process_file() function
  • Split pattern matching into separate matches_include_patterns() and matches_exclude_patterns() functions
  • Implemented union behavior: (source_detection OR include_patterns) AND NOT exclude_patterns
  • Added comprehensive test coverage for backward compatibility and edge cases

- Fix include patterns not working for non-source file types (e.g., *.peb)
- Refactor filtering logic into centralized should_process_file() function
- Implement union behavior: files match if source OR include patterns match
- Add comprehensive test coverage for pattern interactions and edge cases
@seatedro seatedro merged commit a73643f into seatedro:master Aug 11, 2025
1 check passed
@dchristle dchristle deleted the dchristle/fix_include_handling branch October 7, 2025 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants