mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-01-03 05:10:12 +02:00
Don't initialize ignores for file arguments.
We'll never use them, so it's wasted effort.
This commit is contained in:
parent
b8c7864a02
commit
2da0eab2b8
@ -673,6 +673,10 @@ impl Args {
|
||||
pub fn walker(&self, path: &Path) -> Result<walk::Iter> {
|
||||
let wd = WalkDir::new(path).follow_links(self.follow);
|
||||
let mut ig = Ignore::new();
|
||||
// Only register ignore rules if this is a directory. If it's a file,
|
||||
// then it was explicitly given by the end user, so we always search
|
||||
// it.
|
||||
if path.is_dir() {
|
||||
ig.ignore_hidden(!self.hidden);
|
||||
ig.no_ignore(self.no_ignore);
|
||||
ig.no_ignore_vcs(self.no_ignore_vcs);
|
||||
@ -683,6 +687,7 @@ impl Args {
|
||||
if let Some(ref overrides) = self.glob_overrides {
|
||||
ig.add_override(overrides.clone());
|
||||
}
|
||||
}
|
||||
Ok(walk::Iter::new(ig, wd))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user