refactor: conditionally use git root and gitignore in FileWatcher initialization

This commit is contained in:
Paul Gauthier (aider) 2024-11-27 16:19:55 -08:00
parent 52a467806a
commit 4a0100271f

View file

@ -794,10 +794,11 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
if return_coder:
return coder
# ai if git_root, use gitignore
gitignore = [str(Path(root) / ".gitignore")]
# ai pass coder.root to FW!
self.file_watcher = FileWatcher(root, encoding=self.encoding, gitignores=gitignore)
if git_root:
gitignore = [str(Path(git_root) / ".gitignore")]
self.file_watcher = FileWatcher(git_root, encoding=self.encoding, gitignores=gitignore)
else:
self.file_watcher = FileWatcher(".", encoding=self.encoding)
coder.show_announcements()