fix(fs): missing debouncer rename cache (#1245)

* Fix missing debouncer rename cache

* Add change file

* Format
pull/1246/head
Tony 1 year ago committed by GitHub
parent 21387ac199
commit edf9a4f29d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"fs": patch
---
Fixes `RenameMode::From` and `RenameMode::To` never getting converted to `RenameMode::Both` when using `watch` with a debounce on Windows

@ -100,7 +100,7 @@ pub async fn watch<R: Runtime>(
)?);
}
let mode = if options.recursive {
let recursive_mode = if options.recursive {
RecursiveMode::Recursive
} else {
RecursiveMode::NonRecursive
@ -110,7 +110,8 @@ pub async fn watch<R: Runtime>(
let (tx, rx) = channel();
let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?;
for path in &resolved_paths {
debouncer.watcher().watch(path.as_ref(), mode)?;
debouncer.watcher().watch(path.as_ref(), recursive_mode)?;
debouncer.cache().add_root(path, recursive_mode);
}
watch_debounced(on_event, rx);
WatcherKind::Debouncer(debouncer)
@ -118,7 +119,7 @@ pub async fn watch<R: Runtime>(
let (tx, rx) = channel();
let mut watcher = RecommendedWatcher::new(tx, Config::default())?;
for path in &resolved_paths {
watcher.watch(path.as_ref(), mode)?;
watcher.watch(path.as_ref(), recursive_mode)?;
}
watch_raw(on_event, rx);
WatcherKind::Watcher(watcher)

Loading…
Cancel
Save