mirror of https://github.com/sharkdp/fd.git
Fix incorrect usage of `WalkState::Skip` with explanations
This commit is contained in:
parent
7d49fb9e29
commit
75b612f4fc
13
src/walk.rs
13
src/walk.rs
|
@ -538,9 +538,16 @@ fn spawn_senders(
|
||||||
.iter()
|
.iter()
|
||||||
.any(|glob| glob.is_match(&path))
|
.any(|glob| glob.is_match(&path))
|
||||||
{
|
{
|
||||||
// emulate Git's behavior of skipping any matched directory entirely
|
// Ideally we want to return `WalkState::Skip` to emulate gitignore's
|
||||||
// see https://git-scm.com/docs/gitignore#_pattern_format
|
// behavior of skipping any matched directory entirely
|
||||||
return ignore::WalkState::Skip;
|
// Unfortunately this will make the search behaviour inconsistent
|
||||||
|
// because this filter happens outside of the directory walker
|
||||||
|
//
|
||||||
|
// E.g. Given directory structure `/foo/bar/` and CWD `/`:
|
||||||
|
// - `fd --exclude-absolute '/foo'` will return nothing
|
||||||
|
// - `fd --exclude-absolute '/foo' bar` will return '/foo/bar'
|
||||||
|
// Obviously this makes no sense
|
||||||
|
return ignore::WalkState::Continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
Loading…
Reference in New Issue