Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore: handling of broken symlinks #1503

Closed
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
18 changes: 18 additions & 0 deletions crates/ignore/src/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,24 @@ mod tests {
assert_paths(td.path(), &builder.follow_links(true), &["a", "a/b"]);
}

#[cfg(unix)] // because symlinks on windows are weird
#[test]
fn broken_symlinks() {
let td = tmpdir();
mkdirp(td.path().join("dir"));
symlink(td.path().join("dir"), td.path().join("normal_link"));
symlink(td.path().join("non-existing"), td.path().join("broken_link"));

let mut builder = WalkBuilder::new(td.path());
assert_paths(td.path(), &builder, &["dir", "normal_link", "broken_link"]);

assert_paths(
td.path(),
&builder.follow_links(true),
&["dir", "normal_link", "broken_link"],
);
}

// It's a little tricky to test the 'same_file_system' option since
// we need an environment with more than one file system. We adopt a
// heuristic where /sys is typically a distinct volume on Linux and roll
Expand Down