Extract explicit (non-wildcard) patterns that should always be included
(self, include_patterns: List[str])
| 173 | return len(directories) |
| 174 | |
| 175 | def _get_explicit_patterns(self, include_patterns: List[str]) -> set[str]: |
| 176 | """Extract explicit (non-wildcard) patterns that should always be included""" |
| 177 | explicit_patterns = set() |
| 178 | |
| 179 | for pattern in include_patterns: |
| 180 | # If pattern doesn't contain wildcards, it's explicit |
| 181 | if '*' not in pattern and '?' not in pattern: |
| 182 | # Remove leading slash for comparison |
| 183 | explicit_patterns.add(pattern.lstrip('/')) |
| 184 | |
| 185 | # Also add parent directories as explicit (so hidden dirs can be traversed) |
| 186 | path_parts = pattern.lstrip('/').split('/') |
| 187 | for i in range(1, len(path_parts)): |
| 188 | parent_path = '/'.join(path_parts[:i]) |
| 189 | explicit_patterns.add(parent_path) |
| 190 | |
| 191 | return explicit_patterns |
| 192 | |
| 193 | def _is_explicitly_included(self, file_path: str, explicit_patterns: set[str]) -> bool: |
| 194 | """Check if a file/directory is explicitly included in patterns""" |