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>
This commit is contained in:
bors[bot] 2020-10-16 12:53:10 +00:00 committed by GitHub
commit 1af6275f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();