Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions crates/ignore/src/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,11 @@ impl<'s> Worker<'s> {
}
};
let is_symlink = dent.file_type().map_or(false, |ft| ft.is_symlink());
// N.B. See analogous call in the single-threaded implementation about
// why it's important for this to come before the checks below.
if should_skip_entry(ig, &dent) {
return WalkState::Continue;
}
if self.follow_links && is_symlink {
let path = dent.path().to_path_buf();
dent = match DirEntryRaw::from_path(depth, path, true) {
Expand All @@ -1764,11 +1769,6 @@ impl<'s> Worker<'s> {
}
}
}
// N.B. See analogous call in the single-threaded implementation about
// why it's important for this to come before the checks below.
if should_skip_entry(ig, &dent) {
return WalkState::Continue;
}
if let Some(ref stdout) = self.skip {
let is_stdout = match path_equals(&dent, stdout) {
Ok(is_stdout) => is_stdout,
Expand Down Expand Up @@ -2384,6 +2384,18 @@ mod tests {
);
}

#[cfg(unix)] // because symlinks on windows are weird
#[test]
fn ignored_broken_symlink_follow_parallel() {
let td = tmpdir();
wfile(td.path().join(".gitignore"), "broken_symlink\n");
symlink("does-not-exist", td.path().join("broken_symlink"));

let mut builder = WalkBuilder::new(td.path());
builder.follow_links(true);
assert_paths(td.path(), &builder, &[]);
}

#[cfg(unix)] // because symlinks on windows are weird
#[test]
fn first_path_not_symlink() {
Expand Down
Loading