mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-29 05:57:07 +02:00
This makes it so the presence of `.jj` will cause ripgrep to treat it as a VCS directory, just as if `.git` were present. This is useful for ripgrep's default behavior when working with jj repositories that don't have a `.git` but do have `.gitignore`. Namely, ripgrep requires the presence of a VCS repository in order to respect `.gitignore`. We don't handle clone-specific exclude rules for jj repositories without `.git` though. It seems it isn't 100% set yet where we can find those[1]. Closes #2842 [1]: https://github.com/BurntSushi/ripgrep/pull/2842#discussion_r2020076722
ignore
The ignore crate provides a fast recursive directory iterator that respects
various filters such as globs, file types and .gitignore files. This crate
also provides lower level direct access to gitignore and file type matchers.
Dual-licensed under MIT or the UNLICENSE.
Documentation
Usage
Add this to your Cargo.toml:
[dependencies]
ignore = "0.4"
Example
This example shows the most basic usage of this crate. This code will
recursively traverse the current directory while automatically filtering out
files and directories according to ignore globs found in files like
.ignore and .gitignore:
use ignore::Walk;
for result in Walk::new("./") {
// Each item yielded by the iterator is either a directory entry or an
// error, so either print the path or the error.
match result {
Ok(entry) => println!("{}", entry.path().display()),
Err(err) => println!("ERROR: {}", err),
}
}
Example: advanced
By default, the recursive directory iterator will ignore hidden files and
directories. This can be disabled by building the iterator with WalkBuilder:
use ignore::WalkBuilder;
for result in WalkBuilder::new("./").hidden(false).build() {
println!("{:?}", result);
}
See the documentation for WalkBuilder for many other options.