1515from enum import Enum , unique
1616from typing import Final , TypeAlias as _TypeAlias
1717
18- from pathspec import PathSpec
18+ from pathspec import GitIgnoreSpec
1919from pathspec .patterns .gitignore import GitIgnorePatternError
2020
2121from mypy import pyinfo
@@ -724,7 +724,7 @@ def matches_gitignore(subpath: str, fscache: FileSystemCache, verbose: bool) ->
724724
725725
726726@functools .lru_cache
727- def find_gitignores (dir : str ) -> list [tuple [str , PathSpec ]]:
727+ def find_gitignores (dir : str ) -> list [tuple [str , GitIgnoreSpec ]]:
728728 parent_dir = os .path .dirname (dir )
729729 if parent_dir == dir or os .path .exists (os .path .join (dir , ".git" )):
730730 parent_gitignores = []
@@ -733,7 +733,7 @@ def find_gitignores(dir: str) -> list[tuple[str, PathSpec]]:
733733 with open (git_info_exclude ) as f :
734734 exclude_lines = f .readlines ()
735735 try :
736- parent_gitignores = [(dir , PathSpec .from_lines ("gitignore" , exclude_lines ))]
736+ parent_gitignores = [(dir , GitIgnoreSpec .from_lines ("gitignore" , exclude_lines ))]
737737 except GitIgnorePatternError :
738738 print (f"error: could not parse { git_info_exclude } " , file = sys .stderr )
739739 else :
@@ -744,7 +744,7 @@ def find_gitignores(dir: str) -> list[tuple[str, PathSpec]]:
744744 with open (gitignore ) as f :
745745 lines = f .readlines ()
746746 try :
747- return parent_gitignores + [(dir , PathSpec .from_lines ("gitignore" , lines ))]
747+ return parent_gitignores + [(dir , GitIgnoreSpec .from_lines ("gitignore" , lines ))]
748748 except GitIgnorePatternError :
749749 print (f"error: could not parse { gitignore } " , file = sys .stderr )
750750 return parent_gitignores
0 commit comments