about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-10-16 12:53:10 +0000
committerGitHub <noreply@github.com>2020-10-16 12:53:10 +0000
commit1af6275f204fa5a0ec35f3dca96476bcf5112175 (patch)
tree5927fa10a8fea590d1d48777e524f3ffa8f85286
parentfb2d332f5f6aa45eb282aebdd01de4bc0ef8a39e (diff)
parente821aa842bd3f8beeda6b0c9f18db87af0de8adc (diff)
downloadrust-1af6275f204fa5a0ec35f3dca96476bcf5112175.tar.gz
rust-1af6275f204fa5a0ec35f3dca96476bcf5112175.zip
Merge #6246
6246: Follow symlinks when walking project trees r=lnicola a=dfoxfranke

Fixes #3691.

~~WIP pending further testing~~:

- [X] Verify that symlinked files get indexed.
- [x] Verify that files in symlinked directories get indexed.
- [x] Verify that inotify events are properly received and handled when the target of a symlink resides outside the project tree.

Co-authored-by: Daniel Fox Franke <dfoxfranke@gmail.com>
-rw-r--r--crates/vfs-notify/src/lib.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs
index e1e36612a60..c605bcf3c82 100644
--- a/crates/vfs-notify/src/lib.rs
+++ b/crates/vfs-notify/src/lib.rs
@@ -165,14 +165,15 @@ impl NotifyActor {
                 let mut res = Vec::new();
 
                 for root in dirs.include.iter() {
-                    let walkdir = WalkDir::new(root).into_iter().filter_entry(|entry| {
-                        if !entry.file_type().is_dir() {
-                            return true;
-                        }
-                        let path = AbsPath::assert(entry.path());
-                        root == path
-                            || dirs.exclude.iter().chain(&dirs.include).all(|it| it != path)
-                    });
+                    let walkdir =
+                        WalkDir::new(root).follow_links(true).into_iter().filter_entry(|entry| {
+                            if !entry.file_type().is_dir() {
+                                return true;
+                            }
+                            let path = AbsPath::assert(entry.path());
+                            root == path
+                                || dirs.exclude.iter().chain(&dirs.include).all(|it| it != path)
+                        });
 
                     let files = walkdir.filter_map(|it| it.ok()).filter_map(|entry| {
                         let is_dir = entry.file_type().is_dir();