fix: constrain external grep ignore ancestor matching

This commit is contained in:
2026-09-30 13:58:39 +09:00
parent 699a3c051c
commit cbf1b83599
2 changed files with 43 additions and 2 deletions
+3 -2
View File
@@ -282,9 +282,10 @@ impl DescriptorIgnoreMatchers {
let matcher = builder.build().map_err(|_| {
FsError::InvalidArgument("ignore patterns could not be compiled".to_string())
})?;
// An explicitly selected search root is traversed even when an ancestor
// ignores that directory, matching path-backed Grep behavior.
// An explicitly selected search root is traversed even when a strict
// ancestor ignores that directory, matching path-backed Grep behavior.
if directory != explicit_base
&& explicit_base.starts_with(directory)
&& matcher
.matched_path_or_any_parents(explicit_base, true)
.is_ignore()