Skip to content
Myr

ignore: only stat `.jj` if we actually care

Before adoption: this commit came in with the history the project adopted, so no landing records it.

I was comparing the work being done by fd and find and noticed (with `strace -f -c -S` calls) that fd was doing a ton of failed `statx` calls. Upon closer inspection it was stating `.jj` even though I was passing `--no-ignore`. Eventually I turned up this check in `Ignore::add_child_path` that was doing stat on `.jj` regardless of whether the options request it. With this patch it'll only stat `.jj` if that's relevant to the query. PR #3212

authored by Ian McKellar · committed by Andrew Gallant · parent 36b7597 · Browse files · 2 files+10 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−4 removed

  • other:+10 added−4 removed

2 files+10 added−4 removed

modified:crates/ignore/src/dir.rs+5 added-4 removed
254 unmodified lines
255 }256257 /// Like add_child, but takes a full path and returns an IgnoreInner.258 fn add_child_path(&self, dir: &Path) -> (IgnoreInner, Option<Error>) {259 let git_type = if self.0.opts.require_git260 && (self.0.opts.git_ignore || self.0.opts.git_exclude)261 {259 let check_vcs_dir = self.0.opts.require_git260 && (self.0.opts.git_ignore || self.0.opts.git_exclude);261 let git_type = if check_vcs_dir {262 dir.join(".git").metadata().ok().map(|md| md.file_type())263 } else {264 None265 };266 let has_git = git_type.is_some() || dir.join(".jj").exists();266 let has_git =267 check_vcs_dir && (git_type.is_some() || dir.join(".jj").exists());268269 let mut errs = PartialErrorBuilder::default();270 let custom_ig_matcher = if self.0.custom_ignore_filenames.is_empty() {271 Gitignore::empty()
1034 unmodified lines
modified:CHANGELOG.md+5 added
1TBD2===3Unreleased changes. Release notes have not yet been written.45Bug fixes:67* [BUG #3212](https://github.com/BurntSushi/ripgrep/pull/3212):8 Don't check for the existence of `.jj` when `--no-ignore` is used.9101115.1.012======13This is a small release that fixes a bug with how ripgrep handles line14buffering. This might manifest as ripgrep printing output later than you
1831 unmodified lines