Skip to content

Commit

Permalink
fix symlinks and dotfiles while reading glob (#8865)
Browse files Browse the repository at this point in the history
### 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.
-->
  • Loading branch information
sokra authored Jul 29, 2024
1 parent 9061d95 commit f1eb162
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions crates/turbo-tasks-fs/src/read_glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,31 @@ async fn read_glob_internal(
let glob_value = glob.await?;
match &*dir {
DirectoryContent::Entries(entries) => {
for item in entries.iter() {
match item {
(segment, DirectoryEntry::Directory(path)) => {
for (segment, entry) in entries.iter() {
if !include_dot_files && segment.starts_with('.') {
continue;
}
let entry = entry.resolve_symlink().await?;
match entry {
DirectoryEntry::Directory(path) => {
let full_path = format!("{prefix}{segment}");
let full_path_prefix: RcStr = format!("{full_path}/").into();
if glob_value.execute(&full_path) {
result
.results
.insert(full_path.clone(), DirectoryEntry::Directory(*path));
.insert(full_path.clone(), DirectoryEntry::Directory(path));
}
if glob_value.execute(&full_path_prefix) {
result.inner.insert(
full_path,
read_glob_inner(full_path_prefix, *path, glob, include_dot_files),
read_glob_inner(full_path_prefix, path, glob, include_dot_files),
);
}
}
(segment, entry) => {
entry => {
let full_path = format!("{prefix}{segment}");
if glob_value.execute(&full_path) {
result.results.insert(full_path, *entry);
result.results.insert(full_path, entry);
}
}
}
Expand Down

0 comments on commit f1eb162

Please sign in to comment.