From e1ba1befa92a945e4c4496ac4a4daec40a3c722c Mon Sep 17 00:00:00 2001 From: MischaPanch Date: Thu, 16 Oct 2025 17:56:52 +0200 Subject: [PATCH] Bugfix - special handling of edge case in ignore patterns Was falsely matching project root against something like ".*" in gitignore --- src/serena/project.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/serena/project.py b/src/serena/project.py index 966fc8c7..b2db669e 100644 --- a/src/serena/project.py +++ b/src/serena/project.py @@ -105,6 +105,12 @@ class Project: :return: whether the path should be ignored """ + # special case, never ignore the project root itself + # If the user ignores hidden files, "." might match against the corresponding PathSpec pattern. + # The empty string also points to the project root and should never be ignored. + if str(relative_path) in [".", ""]: + return False + abs_path = os.path.join(self.project_root, relative_path) if not os.path.exists(abs_path): raise FileNotFoundError(f"File {abs_path} not found, the ignore check cannot be performed")