From f83d72cf325fb7a85e0a8a683e1b52e0ac9cbb8c Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Fri, 22 Aug 2025 18:36:46 +0200 Subject: [PATCH] Log time taken for gitignore file discovery/parsing --- src/serena/util/file_system.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/serena/util/file_system.py b/src/serena/util/file_system.py index f855f5ef..6f9739af 100644 --- a/src/serena/util/file_system.py +++ b/src/serena/util/file_system.py @@ -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]: """