Skip to content

Commit a011d02

Browse files
committed
Use fscache
1 parent 41af4e9 commit a011d02

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

mypy/find_sources.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ def find_sources_in_dir(self, path: str) -> list[BuildSource]:
120120

121121
if matches_exclude(subpath, self.exclude, self.fscache, self.verbosity >= 2):
122122
continue
123-
if self.exclude_gitignore and matches_gitignore(subpath, self.verbosity >= 2):
123+
if self.exclude_gitignore and matches_gitignore(
124+
subpath, self.fscache, self.verbosity >= 2
125+
):
124126
continue
125127

126128
if self.fscache.isdir(subpath):

mypy/modulefinder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def find_modules_recursive(self, module: str) -> list[BuildSource]:
631631
if (
632632
self.options
633633
and self.options.exclude_gitignore
634-
and matches_gitignore(subpath, self.options.verbosity >= 2)
634+
and matches_gitignore(subpath, self.fscache, self.options.verbosity >= 2)
635635
):
636636
continue
637637

@@ -673,11 +673,11 @@ def matches_exclude(
673673
return False
674674

675675

676-
def matches_gitignore(subpath: str, verbose: bool) -> bool:
676+
def matches_gitignore(subpath: str, fscache: FileSystemCache, verbose: bool) -> bool:
677677
dir, _ = os.path.split(subpath)
678678
for gi_path, gi_spec in find_gitignores(dir):
679679
relative_path = os.path.relpath(subpath, gi_path)
680-
if os.path.isdir(relative_path):
680+
if fscache.isdir(relative_path):
681681
relative_path = relative_path + "/"
682682
if gi_spec.match_file(relative_path):
683683
if verbose:

0 commit comments

Comments
 (0)