Skip to content

feat[ignore]: Always include depth in errors from WalkDir#3458

Merged
BurntSushi merged 1 commit into
BurntSushi:masterfrom
tmccombs:withpath-depth
Jul 1, 2026
Merged

feat[ignore]: Always include depth in errors from WalkDir#3458
BurntSushi merged 1 commit into
BurntSushi:masterfrom
tmccombs:withpath-depth

Conversation

@tmccombs

@tmccombs tmccombs commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Include the depth in I/O errors from WalkDir as well, so that the consumer can handle the error differently depending on depth. For example, this would allow ignore broken symlinks that don't match certain depth criteria.

Fixes: #3453

Include the depth in I/O errors from WalkDir as well, so that the
consumer can handle the error differently depending on depth. For
example, this would allow ignore broken symlinks that don't match
certain depth criteria.

Fixes: BurntSushi#3453
tmccombs added a commit to tmccombs/fd that referenced this pull request Jul 1, 2026
use `ignore::Error::io_error()` to inspect the `std::io::Error` insted
of pattern matching on `ignore::Error::Io`.

This avoids relying on the implementation of ignore and how it organizes
the error. In particular, this would allow us to handle if the IO error
was wrapped in a `WithDepth`, as would be the case if
BurntSushi/ripgrep#3458 was merged.

This also allows us to remove some duplicate code.

@BurntSushi BurntSushi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK let's see what happens!

Note that I would suggest writing your code in a way that doesn't care about the nesting order.

(I want to re-iterate how terrible of a design this is for an error. I don't know what I was thinking.)

@BurntSushi BurntSushi merged commit c10f151 into BurntSushi:master Jul 1, 2026
22 checks passed
@BurntSushi

Copy link
Copy Markdown
Owner

This PR is on crates.io in ignore 0.4.27.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ignore] Include depth in WithPath error.

2 participants