diff --git a/lib/src/fsmonitor.rs b/lib/src/fsmonitor.rs index 75f91ab63..c75b39227 100644 --- a/lib/src/fsmonitor.rs +++ b/lib/src/fsmonitor.rs @@ -164,8 +164,9 @@ pub mod watchman { /// Query for changed files since the previous point in time. /// - /// The returned list of paths is absolute. If it is `None`, then the - /// caller must crawl the entire working copy themselves. + /// The returned list of paths is relative to the `working_copy_path`. + /// If it is `None`, then the caller must crawl the entire working copy + /// themselves. #[instrument(skip(self))] pub async fn query_changed_files( &self, @@ -205,10 +206,7 @@ pub mod watchman { let paths = files .unwrap_or_default() .into_iter() - .map(|file_info| { - let NameOnly { name } = file_info; - self.resolved_root.path().join(name.into_inner()) - }) + .map(|NameOnly { name }| name.into_inner()) .collect_vec(); Ok((clock, Some(paths))) } diff --git a/lib/src/local_working_copy.rs b/lib/src/local_working_copy.rs index c864000fe..3d80850ce 100644 --- a/lib/src/local_working_copy.rs +++ b/lib/src/local_working_copy.rs @@ -57,7 +57,7 @@ use crate::matchers::{ use crate::merge::{Merge, MergeBuilder, MergedTreeValue}; use crate::merged_tree::{MergedTree, MergedTreeBuilder}; use crate::op_store::{OperationId, WorkspaceId}; -use crate::repo_path::{FsPathParseError, RepoPath, RepoPathComponent, RepoPathJoin}; +use crate::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin}; use crate::settings::HumanByteSize; use crate::store::Store; use crate::tree::Tree; @@ -866,16 +866,7 @@ impl TreeState { let repo_paths = trace_span!("processing fsmonitor paths").in_scope(|| { changed_files .into_iter() - .filter_map(|path| { - match RepoPath::parse_fs_path( - &self.working_copy_path, - &self.working_copy_path, - path, - ) { - Ok(repo_path) => Some(repo_path), - Err(FsPathParseError::InputNotInRepo(_)) => None, - } - }) + .filter_map(RepoPath::from_relative_path) .collect_vec() }); diff --git a/lib/tests/test_local_working_copy.rs b/lib/tests/test_local_working_copy.rs index 9e66e3caf..6bb9f3b62 100644 --- a/lib/tests/test_local_working_copy.rs +++ b/lib/tests/test_local_working_copy.rs @@ -22,6 +22,7 @@ use std::io::Write; use std::os::unix::fs::PermissionsExt; #[cfg(unix)] use std::os::unix::net::UnixListener; +use std::path::Path; use std::sync::Arc; use itertools::Itertools; @@ -927,10 +928,7 @@ fn test_fsmonitor() { testutils::write_working_copy_file(&workspace_root, &gitignore_path, "to/ignored\n"); let snapshot = |locked_ws: &mut LockedWorkspace, paths: &[&RepoPath]| { - let fs_paths = paths - .iter() - .map(|p| p.to_fs_path(&workspace_root)) - .collect(); + let fs_paths = paths.iter().map(|p| p.to_fs_path(Path::new(""))).collect(); locked_ws .locked_wc() .snapshot(SnapshotOptions {