From 43a94cda5fa4e3dc9255656cc66416c23a75fc5d Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 5 Apr 2023 15:36:01 -0700 Subject: [PATCH] Don't skip worktree updates if unknown entries are removed When rejoining a project, if entries were both created and deleted since joining the project, the guest will receive those entries ids in as removed. --- crates/project/src/worktree.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index b1aebf29f1..cbd80def6c 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -1227,11 +1227,10 @@ impl Snapshot { let mut entries_by_path_edits = Vec::new(); let mut entries_by_id_edits = Vec::new(); for entry_id in update.removed_entries { - let entry = self - .entry_for_id(ProjectEntryId::from_proto(entry_id)) - .ok_or_else(|| anyhow!("unknown entry {}", entry_id))?; - entries_by_path_edits.push(Edit::Remove(PathKey(entry.path.clone()))); - entries_by_id_edits.push(Edit::Remove(entry.id)); + if let Some(entry) = self.entry_for_id(ProjectEntryId::from_proto(entry_id)) { + entries_by_path_edits.push(Edit::Remove(PathKey(entry.path.clone()))); + entries_by_id_edits.push(Edit::Remove(entry.id)); + } } for entry in update.updated_entries {