mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-05 20:55:05 +00:00
fsmonitor: keep paths relative to the workspace root
Since the caller wants repo-relative paths, it doesn't make sense to convert them back and forth.
This commit is contained in:
parent
a4f6e0de0b
commit
c16c89bc27
3 changed files with 8 additions and 21 deletions
|
@ -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)))
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
});
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue