This commit includes a new method, same_file_system, which when
enabled, will cause walkdir to only descend into directories that are on
the same file system as the root path.
Closes #8, Closes #107
While this PR retains the authorship of #107, this ended up requiring significant refactoring:
Instead of wringing our hands over uncloneable I/O errors, we simply delay the discovery of the root file path's device number until the first call to next, and if an error comes up there, we return it and quit iteration. This also eliminates a redundant store of the root file path.
We make sure walkdir continues to compile on non-Unix/non-Windows platforms. If same_file_system is used on an unsupported platform, then an error is returned.
Fix a bug in the behavior of the program. The common behavior of options like this seems to be to yield the directory that is the root of another file system, but to simply not descend into it. This makes sense, since every entry really belongs to its parent directory, which by induction, is on the same file system as the root. This fixes a critical performance bug as well, in that #107 was making an extra stat call for every entry, but we only need to make it for every directory. This brings the performance of walkdir -x ./ to par with find ./ -xdev.
Fix a variety of formatting bugaboos.
Improve the documentation of same_file_system as well.
This commit includes a new method,
same_file_system
, which when enabled, will cause walkdir to only descend into directories that are on the same file system as the root path.Closes #8, Closes #107
While this PR retains the authorship of #107, this ended up requiring significant refactoring:
next
, and if an error comes up there, we return it and quit iteration. This also eliminates a redundant store of the root file path.same_file_system
is used on an unsupported platform, then an error is returned.walkdir -x ./
to par withfind ./ -xdev
.same_file_system
as well.