summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-11-22 19:40:02 +0800
committer魏曹先生 <1992414357@qq.com>2025-11-22 19:40:02 +0800
commitbe76a48b6b53756fe1ba2f2ddd44bc14c9eb35bb (patch)
tree741d25b152d40196265b729e1633dea5cd4e5b43 /crates
parent855258f45e593b31824016f539f716a549ae483b (diff)
Strip workspace prefix from new paths in moved file detection
Diffstat (limited to 'crates')
-rw-r--r--crates/vcs_data/src/data/local/file_status.rs5
1 files changed, 5 insertions, 0 deletions
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