Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

worktree: Remove unwrap in BackgroundScanner::update_ignore_status (#39191)

Bennet Bo Fenner29afc0412ee3
diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs
index f5b8448ba0b..807aa994312 100644
--- a/crates/worktree/src/worktree.rs
+++ b/crates/worktree/src/worktree.rs
@@ -4547,10 +4547,21 @@ impl BackgroundScanner {
let mut entries_by_id_edits = Vec::new();
let mut entries_by_path_edits = Vec::new();
- let path = job
+ let Some(path) = job
.abs_path
.strip_prefix(snapshot.abs_path.as_path())
- .unwrap();
+ .map_err(|_| {
+ anyhow::anyhow!(
+ "Failed to strip prefix '{}' from path '{}'",
+ snapshot.abs_path.as_path().display(),
+ job.abs_path.display()
+ )
+ })
+ .log_err()
+ else {
+ return;
+ };
+
let Some(path) = RelPath::new(&path, PathStyle::local()).log_err() else {
return;
};