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: Fix race condition when a root of worktree is .git directory (#12995)

Piotr Osiewicz14bf07c91626
diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs
index 2ac4bb9676c..ce967082dc9 100644
--- a/crates/worktree/src/worktree.rs
+++ b/crates/worktree/src/worktree.rs
@@ -3988,7 +3988,10 @@ impl BackgroundScanner {
}
if let (Some(scan_queue_tx), true) = (&scan_queue_tx, fs_entry.is_dir()) {
- if state.should_scan_directory(&fs_entry) {
+ if state.should_scan_directory(&fs_entry)
+ || (fs_entry.path.as_os_str().is_empty()
+ && abs_path.file_name() == Some(*DOT_GIT))
+ {
state.enqueue_scan_dir(abs_path, &fs_entry, scan_queue_tx);
} else {
fs_entry.kind = EntryKind::UnloadedDir;