Log time taken for gitignore file discovery/parsing

This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2025-08-22 18:43:04 +02:00
1 parent 2c23e1151c
commit f83d72cf32
1 file changed
+7 -5
+7 -5
View File
@@ -7,6 +7,7 @@ from typing import NamedTuple
import pathspec
from pathspec import PathSpec
from sensai.util.logging import LogTime
log = logging.getLogger(__name__)
@@ -137,11 +138,12 @@ class GitignoreParser:
def _load_gitignore_files(self) -> None:
"""Load all gitignore files from the repository."""
for gitignore_path in self._iter_gitignore_files():
log.info("Processing gitignore file: %s", gitignore_path)
spec = self._create_ignore_spec(gitignore_path)
if spec.patterns: # Only add non-empty specs
self.ignore_specs.append(spec)
with LogTime("Loading of .gitignore files", logger=log):
for gitignore_path in self._iter_gitignore_files():
log.info("Processing .gitignore file: %s", gitignore_path)
spec = self._create_ignore_spec(gitignore_path)
if spec.patterns: # Only add non-empty specs
self.ignore_specs.append(spec)
def _iter_gitignore_files(self, follow_symlinks: bool = False) -> Iterator[str]:
"""