refactor: Improve FileWatcher initialization with gitignore handling

This commit is contained in:
Paul Gauthier 2024-11-27 16:22:07 -08:00 committed by Paul Gauthier (aider)
parent 4a0100271f
commit 0d4f9f00ee

View file

@ -794,11 +794,11 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
if return_coder: if return_coder:
return coder return coder
ignores = []
if git_root: if git_root:
gitignore = [str(Path(git_root) / ".gitignore")] ignores += [str(Path(git_root) / ".gitignore")]
self.file_watcher = FileWatcher(git_root, encoding=self.encoding, gitignores=gitignore) # ai: add aiderignores too!
else: io.file_watcher = FileWatcher(coder, encoding=self.encoding, gitignores=gitignore)
self.file_watcher = FileWatcher(".", encoding=self.encoding)
coder.show_announcements() coder.show_announcements()