Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix inconsistent worktree state when renaming entries while scanning
Max Brunsfeld5ea49b3ae3d3
diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rsindex 7a826740f14..d0cf2faa7ee 100644--- a/crates/project/src/worktree.rs+++ b/crates/project/src/worktree.rs@@ -1491,7 +1491,12 @@ impl LocalSnapshot {}let scan_id = self.scan_id;- self.entries_by_path.insert_or_replace(entry.clone(), &());+ let removed = self.entries_by_path.insert_or_replace(entry.clone(), &());+ if let Some(removed) = removed {+ if removed.id != entry.id {+ self.entries_by_id.remove(&removed.id, &());+ }+ }self.entries_by_id.insert_or_replace(PathEntry {id: entry.id,