From be76a48b6b53756fe1ba2f2ddd44bc14c9eb35bb Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 22 Nov 2025 19:40:02 +0800 Subject: Strip workspace prefix from new paths in moved file detection --- crates/vcs_data/src/data/local/file_status.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/vcs_data/src/data') diff --git a/crates/vcs_data/src/data/local/file_status.rs b/crates/vcs_data/src/data/local/file_status.rs index 8b1c17f..ca5799f 100644 --- a/crates/vcs_data/src/data/local/file_status.rs +++ b/crates/vcs_data/src/data/local/file_status.rs @@ -188,6 +188,11 @@ impl<'a> AnalyzeResult<'a> { // If these hashes correspond to the hashes of missing files, then this pair of new and lost items will be merged into moved items let mut moved_files: HashSet<(FromRelativePathBuf, ToRelativePathBuf)> = HashSet::new(); for (new_path, new_hash) in file_hashes { + let new_path = new_path + .strip_prefix(&workspace.local_path) + .map(|p| p.to_path_buf()) + .unwrap_or(new_path); + // If the new hash value hits the mapping, add a moved item if let Some(lost_path) = lost_files_hash_mapping.remove(&new_hash) { // Remove this new item and lost item -- cgit