Skip to content

Commit 0365d92

Browse files
authored
fix symlinks and dotfiles while reading glob (vercel/turborepo#8865)
### Description * fix dot files handling while reading glob fix symlink handling while reading glob * fix symlink handling while reading glob ### Testing Instructions <!-- Give a quick description of steps to test your changes. -->
1 parent 3793f6a commit 0365d92

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

crates/turbo-tasks-fs/src/read_glob.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,31 @@ async fn read_glob_internal(
4646
let glob_value = glob.await?;
4747
match &*dir {
4848
DirectoryContent::Entries(entries) => {
49-
for item in entries.iter() {
50-
match item {
51-
(segment, DirectoryEntry::Directory(path)) => {
49+
for (segment, entry) in entries.iter() {
50+
if !include_dot_files && segment.starts_with('.') {
51+
continue;
52+
}
53+
let entry = entry.resolve_symlink().await?;
54+
match entry {
55+
DirectoryEntry::Directory(path) => {
5256
let full_path = format!("{prefix}{segment}");
5357
let full_path_prefix: RcStr = format!("{full_path}/").into();
5458
if glob_value.execute(&full_path) {
5559
result
5660
.results
57-
.insert(full_path.clone(), DirectoryEntry::Directory(*path));
61+
.insert(full_path.clone(), DirectoryEntry::Directory(path));
5862
}
5963
if glob_value.execute(&full_path_prefix) {
6064
result.inner.insert(
6165
full_path,
62-
read_glob_inner(full_path_prefix, *path, glob, include_dot_files),
66+
read_glob_inner(full_path_prefix, path, glob, include_dot_files),
6367
);
6468
}
6569
}
66-
(segment, entry) => {
70+
entry => {
6771
let full_path = format!("{prefix}{segment}");
6872
if glob_value.execute(&full_path) {
69-
result.results.insert(full_path, *entry);
73+
result.results.insert(full_path, entry);
7074
}
7175
}
7276
}

0 commit comments

Comments
 (0)