diff --git a/src/gitingest/ingestion.py b/src/gitingest/ingestion.py index 375c9f9b..24b65b39 100644 --- a/src/gitingest/ingestion.py +++ b/src/gitingest/ingestion.py @@ -12,7 +12,7 @@ from gitingest.utils.path_utils import _is_safe_symlink try: - import tomllib + import tomllib # type: ignore[import] except ImportError: import tomli as tomllib diff --git a/src/gitingest/query_parsing.py b/src/gitingest/query_parsing.py index d2b0147e..e2b0e0cf 100644 --- a/src/gitingest/query_parsing.py +++ b/src/gitingest/query_parsing.py @@ -296,6 +296,9 @@ def _parse_patterns(pattern: Union[str, Set[str]]) -> Set[str]: # Remove empty string if present parsed_patterns = parsed_patterns - {""} + # Normalize Windows paths to Unix-style paths + parsed_patterns = {p.replace("\\", "/") for p in parsed_patterns} + # Validate and normalize each pattern for p in parsed_patterns: if not _is_valid_pattern(p): diff --git a/src/gitingest/utils/ingestion_utils.py b/src/gitingest/utils/ingestion_utils.py index 4ab66849..a9a46613 100644 --- a/src/gitingest/utils/ingestion_utils.py +++ b/src/gitingest/utils/ingestion_utils.py @@ -56,6 +56,9 @@ def _should_include(path: Path, base_path: Path, include_patterns: Set[str]) -> return False rel_str = str(rel_path) + if path.is_dir(): + rel_str += "/" + for pattern in include_patterns: if fnmatch(rel_str, pattern): return True