Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No option to limit search to one file system #507

Closed
FallenWarrior2k opened this issue Nov 13, 2019 · 4 comments
Closed

No option to limit search to one file system #507

FallenWarrior2k opened this issue Nov 13, 2019 · 4 comments
Assignees

Comments

@FallenWarrior2k
Copy link
Contributor

Many tools surrounding file system traversal include an option to disable crossing file system boundaries. find includes the -xdev option, which accomplishes this. fd, however, seems to lack such a feature at the present time. I've looked through the man page and the issue list and was unable to find anything relating to this.

Looking at the docs of the ignore crate, implementation should be quite simple as well: it only requires adding a call to .same_file_system(config.same_file_system) to the WalkBuilder, assuming a corresponding option same_file_system: bool is added to FdOptions, with corresponding changes in build_app() and main().

FallenWarrior2k added a commit to FallenWarrior2k/fd that referenced this issue Nov 14, 2019
This adds a `--same-file-system` CLI option that instructs the walker to
not cross file system boundaries.
Due to the fact that the corresponding option of the `ignore` crate's
`WalkBuilder` does not support platforms other than Unix and Windows,
the option does nothing on platforms other than those.
Closes sharkdp#507
FallenWarrior2k added a commit to FallenWarrior2k/fd that referenced this issue Nov 14, 2019
This adds a `--same-file-system` CLI option that instructs the walker to
not cross file system boundaries.
Due to the fact that the corresponding option of the `ignore` crate's
`WalkBuilder` does not support platforms other than Unix and Windows,
the option does nothing on platforms other than those.
Resolves sharkdp#507
@sharkdp
Copy link
Owner

sharkdp commented Nov 24, 2019

Thank you for your feedback.

See also: #227 #74 #89

Didn't know about the .same_file_system option, though.

@FallenWarrior2k
Copy link
Contributor Author

Oh, sorry. Seems my search terms weren't precise enough.

However, since this uses an existing feature of the ignore crate, there shouldn't be any performance degradation if the option is not used, since the ignore crate defaults it to false anyway. Since it is basically just adding a public API for a feature that already existed, albeit unused, I wonder if you'd consider adding it.

If not, feel free to close this and the corresponding PR.

@sharkdp
Copy link
Owner

sharkdp commented Dec 4, 2019

However, since this uses an existing feature of the ignore crate, there shouldn't be any performance degradation if the option is not used, since the ignore crate defaults it to false anyway. Since it is basically just adding a public API for a feature that already existed, albeit unused, I wonder if you'd consider adding it.

Ok, that sounds reasonable. I'll take a look at the PR soon, thank you.

FallenWarrior2k added a commit to FallenWarrior2k/fd that referenced this issue Dec 30, 2019
This adds a `--same-file-system` CLI option that instructs the walker to
not cross file system boundaries.
Due to the fact that the corresponding option of the `ignore` crate's
`WalkBuilder` does not support platforms other than Unix and Windows,
the option does nothing on platforms other than those.
Resolves sharkdp#507
@sharkdp sharkdp closed this as completed in 8796de5 Jan 1, 2020
@sharkdp sharkdp mentioned this issue Feb 16, 2020
@sharkdp
Copy link
Owner

sharkdp commented Mar 22, 2020

Released in fd 7.5.0

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

No branches or pull requests

2 participants