From 8899c4d84013eefa6ca0f1bbb5ce9566acdac861 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 30 Jan 2024 20:10:52 -0700 Subject: [PATCH] Attempt to fix a panic in worktree scanning (#7128) Somehow (and this should be investigated separately) we're ending up with paths that look like: /path/to/project/../../path/to/dependency, these pass the Ok(repo_path) = path.strip_prefix(), but then fail. Release Notes: - Fixed (hopefully) a panic that could occur due to path confusing in git status --- crates/project/src/worktree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index 4bd5e629946be4b0ce88a838c99a1ec8952b8660..eb0d2d5aeeb24f7ff9f20b52f494bd165cc3440c 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -3863,7 +3863,7 @@ impl BackgroundScanner { fs_entry.is_ignored = ignore_stack.is_abs_path_ignored(&abs_path, is_dir); fs_entry.is_external = !canonical_path.starts_with(&root_canonical_path); - if !is_dir && !fs_entry.is_ignored { + if !is_dir && !fs_entry.is_ignored && !fs_entry.is_external { if let Some((work_dir, repo)) = state.snapshot.local_repo_for_path(path) { if let Ok(repo_path) = path.strip_prefix(work_dir.0) { let repo_path = RepoPath(repo_path.into());