Skip to content

Commit ab31bfb

Browse files
committed
filter changes for .entangled, which may be written to inadvertently
1 parent 6f64ae2 commit ab31bfb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

entangled/commands/watch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
import watchfiles
99

1010

11+
def watch_filter(change: watchfiles.Change, path: str) -> bool:
12+
if path.startswith(".entangled"):
13+
return False
14+
return True
15+
16+
1117
def _watch(_stop_event: Event | None = None, _start_event: Event | None = None):
1218
"""Keep a loop running, watching for changes. This interface is separated
1319
from the CLI one, so that it can be tested using threading instead of
@@ -23,7 +29,7 @@ def stop() -> bool:
2329

2430
dirs = "." # find_watch_dirs()
2531

26-
for changes in watchfiles.watch(dirs, stop_event=_stop_event):
32+
for changes in watchfiles.watch(dirs, stop_event=_stop_event, watch_filter=watch_filter):
2733
run_sync()
2834

2935

0 commit comments

Comments
 (0)