I don't know why `cargo doc` is now failing with Rust 1.60 on Windows,
but just skip running it. For now, we're fine with just testing that it
builds.
This also updates the MSRV in the README to reflect reality.
`IntoIter` and `FilterEntry<IntoIter, P>` will return `None` once they
returned `None`. Implementing `FusedIterator` allows `Iterator::fuse`
method to be optimized.
PR #139
We bump the pinned version in CI to Rust 1.60 without technically
touching our MSRV. I don't have the patience or time to actually fix it
for Rust 1.34. So the next release we'll just bump the MSRV officially
and content ourselves with CI working on Rust 1.60.
With it it's possible to control whether symlinks in the traversal
root are followed, while defaulting to 'true' like before, or if
they are handled like ordinary links.
Ref https://github.com/rust-lang/cargo/pull/11634Fixes#175
This switches to using shorthand struct field initialization. It also
removes a work-around for an older version of Rust on Windows.
Finally, we remove an explicit dependency on winapi, which was
required by the aforementioned work-around. However, we do still
indirectly depend on winapi via winapi-util.
This commit adds sort_by_key and sort_by_file_name convenience routines
for common sorting needs. The signature for sort_by_key in particular
mirrors the eponymous method on slices in the standard library.
Closes#147
And also add a `source` method on the `Error` impl.
And finally, permit the use of the deprecated `description` method,
since removing it would be a breaking change.
A somewhat recent change permitted the `push` function to exit early
after `oldest_opened` was incremented, but before a new entry was pushed
on to the stack. Specifically, the only way this could happen was if
a handle could not be opened to an ancestor path, on Windows only. We
fix this by incrementing `oldest_opened` only after we push a new entry
to the stack.
Credit goes to @LukasKalbertodt for figuring out this bug!
The method sometimes destroyed an internal invariant by not decreasing
`oldest_opened`. That then leads to panics in `push`. We fix this by
calling the canonical `pop` function, which is what should have happened
from the beginning.
This includes a regression test that fails without this fix.
Fixes#118, Closes#124
This moves the DirEntry and Error types out into their own separate
modules.
This is prep work to (hopefully) make the impending refactoring (or
more likely, rewrite) more palatable.
This gets rid of a lot of unnecessary infrastructure around maintaining
the directory hierarchy in a tree. This was principally used in order to
support effective quickcheck tests, but since we dropped quickcheck, we
no longer need such things.
We know center tests around the Dir type, which makes setting up the
tests simpler and easier to understand.
These weren't carrying their weight. Depending on rand is super
annoying, so just stop doing it. In particular, we can bring back the
minimal version check.
This supplants the previous "example" which was more like a debugging
program. So this commit not only rewrites it (dropping docopt in the
process in favor of clap), but moves it to its own non-published binary
crate.
... to 0.6 and 0.8, respectively.
We aren't running tests on the MSRV any more any way, so we might as
well keep on moving.
Unfortunately, the rand ecosystem refuses to advertise and maintain
correct minimal versions in their Cargo.toml, so we have to remove the
minimal version check.
This commit fixes a nasty bug where the root path given to walkdir was
always reported as a symlink, even when 'follow_links' was enabled. This
appears to be a regression introduced by commit 6f72fce as part of
fixing BurntSushi/ripgrep#984.
The central problem was that since root paths should always be followed,
we were creating a DirEntry whose internal file type was always resolved
by following a symlink, but whose 'metadata' method still returned the
metadata of the symlink and not the target. This was problematic and
inconsistent both with and without 'follow_links' enabled.
We also fix the documentation. In particular, we make the docs of 'new'
more unambiguous, where it previously could have been interpreted as
contradictory to the docs on 'DirEntry'. Specifically, 'WalkDir::new'
says:
If root is a symlink, then it is always followed.
But the docs for 'DirEntry::metadata' say
This always calls std::fs::symlink_metadata.
If this entry is a symbolic link and follow_links is enabled, then
std::fs::metadata is called instead.
Similarly, 'DirEntry::file_type' said
If this is a symbolic link and follow_links is true, then this
returns the type of the target.
That is, if 'root' is a symlink and 'follow_links' is NOT enabled,
then the previous incorrect behavior resulted in 'DirEntry::file_type'
behaving as if 'follow_links' was enabled. If 'follow_links'
was enabled, then the previous incorrect behavior resulted in
'DirEntry::metadata' reporting the metadata of the symlink itself.
We fix this by correctly constructing the DirEntry in the first place,
and then adding special case logic to path traversal that will always
attempt to follow the root path if it's a symlink and 'follow_links'
was not enabled. We also tweak the docs on 'WalkDir::new' to be more
precise.
Fixes#115