From 289e13cb466c51194f762eb50b608ddb405e305c Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 4 Feb 2025 13:14:23 -0800 Subject: [PATCH] fix: Convert paths to POSIX format for .gitignore matching on Windows --- aider/watch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/watch.py b/aider/watch.py index 5f247622e..3297e6965 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -95,7 +95,7 @@ class FileWatcher: if self.verbose: dump(rel_path) - if self.gitignore_spec and self.gitignore_spec.match_file(str(rel_path)): + if self.gitignore_spec and self.gitignore_spec.match_file(rel_path.as_posix() + ("/" if path_abs.is_dir() else "")): return False if self.verbose: @@ -121,7 +121,7 @@ class FileWatcher: str(path) for path in self.root.iterdir() if not self.gitignore_spec.match_file( - str(path.relative_to(self.root)) + ("/" if path.is_dir() else "") + path.relative_to(self.root).as_posix() + ("/" if path.is_dir() else "") ) ] # Fallback to watching root if all top-level items are filtered out