Fix --git-since not detecting first file change in filtered directories

The VFS only sets up file watches via read() and read_dir(), not
metadata(). When git filtering caused snapshot_from_vfs to return
early for $path directories, read_dir was never called, so no file
watch was established. This meant file modifications never generated
VFS events and were silently ignored until the server was restarted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 18:04:27 +01:00
parent 0dc37ac848
commit b8106354b0

View File

@@ -160,6 +160,16 @@ pub fn snapshot_project_node(
.canonicalize(full_path.as_ref()) .canonicalize(full_path.as_ref())
.unwrap_or_else(|_| full_path.to_path_buf()); .unwrap_or_else(|_| full_path.to_path_buf());
metadata.relevant_paths.push(normalized); metadata.relevant_paths.push(normalized);
// The VFS only sets up file watches via read() and read_dir(),
// not via metadata(). Since the git filter caused snapshot_from_vfs
// to return early (before read_dir was called), the VFS is not
// watching this path. We must read the directory here to ensure
// the VFS sets up a recursive watch, otherwise file change events
// will never fire and live sync won't detect modifications.
if full_path.is_dir() {
let _ = vfs.read_dir(&full_path);
}
} }
} }