mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
refactor: move filter_func creation to FileWatcher.__init__
This commit is contained in:
parent
cf91101a48
commit
679c960ea1
1 changed files with 10 additions and 4 deletions
|
@ -75,6 +75,11 @@ class FileWatcher:
|
|||
self.watcher_thread = None
|
||||
self.changed_files = set()
|
||||
self.gitignores = gitignores
|
||||
|
||||
# Create filter function during initialization
|
||||
gitignore_paths = [Path(g) for g in self.gitignores] if self.gitignores else []
|
||||
gitignore_spec = load_gitignores(gitignore_paths)
|
||||
self.filter_func = self.create_filter_func(gitignore_spec, None)
|
||||
|
||||
coder.io.file_watcher = self
|
||||
|
||||
|
@ -120,10 +125,11 @@ class FileWatcher:
|
|||
self.stop_event = threading.Event()
|
||||
self.changed_files = set()
|
||||
|
||||
# ai move this to __init__, set self.filter_func!
|
||||
gitignore_paths = [Path(g) for g in self.gitignores] if self.gitignores else []
|
||||
gitignore_spec = load_gitignores(gitignore_paths)
|
||||
filter_func = self.create_filter_func(gitignore_spec, ignore_func)
|
||||
# Update filter_func if ignore_func is provided
|
||||
if ignore_func:
|
||||
gitignore_paths = [Path(g) for g in self.gitignores] if self.gitignores else []
|
||||
gitignore_spec = load_gitignores(gitignore_paths)
|
||||
self.filter_func = self.create_filter_func(gitignore_spec, ignore_func)
|
||||
|
||||
def watch_files():
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue