192 Commits

Author SHA1 Message Date
Andrew Gallant
6fd031c82b
ci: tweak pinned testing
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.
2024-12-31 08:29:38 -05:00
Andrew Gallant
77455462cb
github: add FUNDING 2024-09-25 16:45:14 -04:00
Andrew Gallant
4f26be4d45
2.5.0 2.5.0 2024-03-01 12:55:08 -05:00
YOSHIOKA Takuma
3be5734033
api: implement FusedIterator
`IntoIter` and `FilterEntry<IntoIter, P>` will return `None` once they
returned `None`. Implementing `FusedIterator` allows `Iterator::fuse`
method to be optimized.

PR #139
2024-03-01 12:54:50 -05:00
Andrew Gallant
b0d16b759a
ci: fix it
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.
2023-10-05 21:47:14 -04:00
Andrew Gallant
037c5e16ec
2.4.0 2.4.0 2023-09-05 10:02:13 -04:00
Sebastian Thiel
dcc527d832
api: add follow_root_links() option to WalkDir
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/11634

Fixes #175
2023-09-05 10:01:38 -04:00
Andrew Gallant
61a185fe49
ci: use latest OS versions 2023-05-23 12:46:14 -04:00
Andrew Gallant
1547668537
2.3.3 2.3.3 2023-03-16 08:56:01 -04:00
vsuryamurthy
21be522788
impl: use shorthand initialization, remove old work-around
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.
2023-03-16 08:55:45 -04:00
Andrew Gallant
abf3a15887
2.3.2 2.3.2 2021-03-22 10:30:29 -04:00
Marvin Löbel
461f4a8708
api: add convenience sort routines
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
2021-03-22 10:30:20 -04:00
Alex Touchet
3d1f2f252a
readme: use HTTPS for links
PR #144
2020-12-13 12:15:44 -05:00
Guillaume Gomez
0b3ff12ff5
tests: replace "cfg(test)" with "cfg(doctest)" for readme testing
PR #135
2020-05-07 08:06:55 -04:00
Andrew Gallant
bab4066b21
ci: set override to force selected Rust version 2020-01-11 14:07:55 -05:00
Andrew Gallant
00df609016
2.3.1 2.3.1 2020-01-11 13:56:19 -05:00
Andrew Gallant
ed87b1ee21
edition: switch to Rust 2018 2020-01-11 13:39:17 -05:00
Andrew Gallant
c584a1d56c
style: switch to rustfmt 2020-01-11 13:31:49 -05:00
Andrew Gallant
dc7499a6c6
ci: switch to actions-rs/toolchain 2020-01-11 13:31:49 -05:00
Andrew Gallant
003ee8378c
2.3.0 2.3.0 2020-01-11 12:29:15 -05:00
Andrew Gallant
64367023b1
style: use 'dyn' for trait objects
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.
2020-01-11 12:28:57 -05:00
Andrew Gallant
580acab20f msrv: bump to 1.34.0
For now, we don't switch to Rust 2018 to avoid creating a
larger-than-necessary divergence with the in-progress walkdir 3 rewrite.
2020-01-11 12:23:58 -05:00
Andrew Gallant
901cadaa74 ci: switch to GitHub Actions 2020-01-11 12:23:58 -05:00
Andrew Gallant
8e757b15d1 readme: document MSRV policy 2020-01-11 12:23:58 -05:00
Andrew Gallant
7c7013259e
2.2.9 2.2.9 2019-07-20 13:37:12 -04:00
Andrew Gallant
30e91a74e2 bug: fastidiously increment oldest_opened
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!
2019-07-20 13:37:00 -04:00
Lukas Kalbertodt
7e0754a898 bug: fix use of skip_current_dir
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
2019-07-20 13:37:00 -04:00
Andrew Gallant
e09ce1cc51 internals: re-arrange implementation
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.
2019-07-20 13:37:00 -04:00
Andrew Gallant
4235b6357c tests: rewrite them
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.
2019-07-20 13:37:00 -04:00
Andrew Gallant
011973f170 tests: restructure them
This is in preparation to rewrite the tests.
2019-07-20 13:37:00 -04:00
Andrew Gallant
5d16163ce6 deps: drop quickcheck and rand
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.
2019-07-20 13:37:00 -04:00
Andrew Gallant
526d70b165 list: add new walkdir-list binary
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.
2019-07-20 13:37:00 -04:00
Andrew Gallant
8deb700720 deps: bump rand and quickcheck
... 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.
2019-07-20 13:37:00 -04:00
Andrew Gallant
f85554d459
2.2.8 2.2.8 2019-06-09 09:28:49 -04:00
Andrew Gallant
4eb176fc7a
style: allow bare trait objects
Because we aren't ready to bump our MSRV yet.
2019-06-09 09:27:57 -04:00
Andrew Gallant
b0809eee88
ci: remove minimal version check
Because rand. Sigh.
2019-06-09 09:27:36 -04:00
Andrew Gallant
71c5437f9c
deps: update rand to 0.6 2019-06-09 09:27:19 -04:00
Igor Gnatenko
a457894880
deps: update quickcheck to 0.8 2019-06-09 09:25:23 -04:00
Andrew Gallant
b8bdc069fd
cleanup: remove unused files from the old days 2019-05-01 13:32:43 -04:00
Guillaume Gomez
4c4fdb2abd test: check examples in README
PR #119
2019-05-01 10:52:20 -04:00
Andrew Gallant
830fc25acf
ci: stop testing on MSRV, build only 2019-04-30 13:32:15 -04:00
Andrew Gallant
45deac4d7e
code: remove unnecessary mut 2019-04-30 13:30:48 -04:00
Andrew Gallant
705d06c15d
2.2.7 2.2.7 2018-11-11 09:37:20 -05:00
Andrew Gallant
83b7a24302
walkdir: fix root symlink bug
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
2018-11-11 09:32:29 -05:00
Andrew Gallant
4879ce266a
ci: pin to lazy_static 1.1 in CI 2018-11-07 07:17:55 -05:00
Andrew Gallant
99315723f5
2.2.6 2.2.6 2018-10-29 06:59:16 -04:00
Igor Gnatenko
809360416b ci: exclude CI files
PR #114
2018-10-29 06:58:59 -04:00
Andrew Gallant
e6fe17ca98
2.2.5 2.2.5 2018-08-25 10:46:35 -04:00
Andrew Gallant
80a08041e6
deps: update to quickcheck 0.7 2018-08-25 10:46:33 -04:00
Andrew Gallant
07a38b2948
2.2.4 2.2.4 2018-08-24 23:38:31 -04:00