diff --git a/aider/repo.py b/aider/repo.py index ad0197273..6ec4a0f4a 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -259,6 +259,7 @@ class GitRepo: return str(Path(PurePosixPath((Path(self.root) / path).relative_to(self.root)))) def ignored_file(self, fname): + orig_fname = fname if fname in self.ignore_file_cache: return self.ignore_file_cache[fname] @@ -266,6 +267,7 @@ class GitRepo: try: fname_path = Path(self.normalize_path(fname)).resolve() cwd_path = Path.cwd().resolve() + if not fname_path.is_relative_to(cwd_path): return True except ValueError: @@ -290,7 +292,7 @@ class GitRepo: ) result = self.aider_ignore_spec.match_file(fname) - self.ignore_file_cache[fname] = result + self.ignore_file_cache[orig_fname] = result return result def path_in_repo(self, path):