worktree: Make expanded symlinks be indexed by default (#51382)

Andre Roelofs created

Closes #41887

This is a stable subset of other efforts to make symlink flows more
intuitive like #46344

Release Notes:

- Fixed expanded symlinks not being searchable

Change summary

crates/worktree/src/worktree.rs | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Detailed changes

crates/worktree/src/worktree.rs 🔗

@@ -2776,7 +2776,7 @@ impl LocalSnapshot {
         for entry in self.entries_by_path.cursor::<()>(()) {
             if entry.is_file() {
                 assert_eq!(files.next().unwrap().inode, entry.inode);
-                if (!entry.is_ignored && !entry.is_external) || entry.is_always_included {
+                if !entry.is_ignored || entry.is_always_included {
                     assert_eq!(visible_files.next().unwrap().inode, entry.inode);
                 }
             }
@@ -3455,8 +3455,7 @@ pub struct Entry {
     /// symlink.
     ///
     /// We only scan entries outside of the worktree once the symlinked
-    /// directory is expanded. External entries are treated like gitignored
-    /// entries in that they are not included in searches.
+    /// directory is expanded.
     pub is_external: bool,
 
     /// Whether this entry is considered to be a `.env` file.
@@ -3661,8 +3660,7 @@ impl sum_tree::Item for Entry {
     type Summary = EntrySummary;
 
     fn summary(&self, _cx: ()) -> Self::Summary {
-        let non_ignored_count = if (self.is_ignored || self.is_external) && !self.is_always_included
-        {
+        let non_ignored_count = if self.is_ignored && !self.is_always_included {
             0
         } else {
             1