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.

Fix Linux search issues (#13479)

Mikayla Makidf11b646dad4
diff --git a/crates/worktree/src/ignore.rs b/crates/worktree/src/ignore.rs
index 41e5746f13c..e8ba9192be9 100644
--- a/crates/worktree/src/ignore.rs
+++ b/crates/worktree/src/ignore.rs
@@ -1,6 +1,7 @@
use ignore::gitignore::Gitignore;
use std::{ffi::OsStr, path::Path, sync::Arc};
+#[derive(Debug)]
pub enum IgnoreStack {
None,
Some {
diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs
index 4df19d8cce6..056e00585d4 100644
--- a/crates/worktree/src/worktree.rs
+++ b/crates/worktree/src/worktree.rs
@@ -3825,19 +3825,8 @@ impl BackgroundScanner {
.collect::<Vec<_>>()
.await;
- // Ensure .git and gitignore files are processed first.
- let mut ixs_to_move_to_front = Vec::new();
- for (ix, child_abs_path) in child_paths.iter().enumerate() {
- let filename = child_abs_path.file_name().unwrap();
- if filename == *DOT_GIT {
- ixs_to_move_to_front.insert(0, ix);
- } else if filename == *GITIGNORE {
- ixs_to_move_to_front.push(ix);
- }
- }
- for (dest_ix, src_ix) in ixs_to_move_to_front.into_iter().enumerate() {
- child_paths.swap(dest_ix, src_ix);
- }
+ // Ensure that .git and .gitignore are processed first.
+ child_paths.sort_unstable();
for child_abs_path in child_paths {
let child_abs_path: Arc<Path> = child_abs_path.into();
@@ -4087,6 +4076,7 @@ impl BackgroundScanner {
let is_dir = fs_entry.is_dir();
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);
fs_entry.is_private = self.is_path_private(path);
@@ -4248,6 +4238,7 @@ impl BackgroundScanner {
let was_ignored = entry.is_ignored;
let abs_path: Arc<Path> = snapshot.abs_path().join(&entry.path).into();
entry.is_ignored = ignore_stack.is_abs_path_ignored(&abs_path, entry.is_dir());
+
if entry.is_dir() {
let child_ignore_stack = if entry.is_ignored {
IgnoreStack::all()