mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +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.watcher_thread = None
|
||||||
self.changed_files = set()
|
self.changed_files = set()
|
||||||
self.gitignores = gitignores
|
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
|
coder.io.file_watcher = self
|
||||||
|
|
||||||
|
@ -120,10 +125,11 @@ class FileWatcher:
|
||||||
self.stop_event = threading.Event()
|
self.stop_event = threading.Event()
|
||||||
self.changed_files = set()
|
self.changed_files = set()
|
||||||
|
|
||||||
# ai move this to __init__, set self.filter_func!
|
# Update filter_func if ignore_func is provided
|
||||||
gitignore_paths = [Path(g) for g in self.gitignores] if self.gitignores else []
|
if ignore_func:
|
||||||
gitignore_spec = load_gitignores(gitignore_paths)
|
gitignore_paths = [Path(g) for g in self.gitignores] if self.gitignores else []
|
||||||
filter_func = self.create_filter_func(gitignore_spec, ignore_func)
|
gitignore_spec = load_gitignores(gitignore_paths)
|
||||||
|
self.filter_func = self.create_filter_func(gitignore_spec, ignore_func)
|
||||||
|
|
||||||
def watch_files():
|
def watch_files():
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue