fix(coding-agent): respect nested repo ignore boundaries in find

closes #5960
This commit is contained in:
Armin Ronacher
2026-06-22 10:57:39 +02:00
parent 5641d6bac5
commit 756a4e8f6f
2 changed files with 19 additions and 11 deletions
+1
View File
@@ -4,6 +4,7 @@
### Fixed ### Fixed
- Fixed the `find` tool to respect nested git repository boundaries when parent `.gitignore` rules ignore the nested repo ([#5960](https://github.com/earendil-works/pi/issues/5960)).
- Fixed the usage docs slash command table to include `/trust` and `/import` ([#5959](https://github.com/earendil-works/pi/issues/5959)). - Fixed the usage docs slash command table to include `/trust` and `/import` ([#5959](https://github.com/earendil-works/pi/issues/5959)).
- Fixed broken TUI documentation links to the plan-mode extension example ([#5957](https://github.com/earendil-works/pi/issues/5957)). - Fixed broken TUI documentation links to the plan-mode extension example ([#5957](https://github.com/earendil-works/pi/issues/5957)).
- Fixed transient extension UI and session-start messages emitted during session replacement or reload so they remain visible, and kept reload input blocked until reload completes ([#5943](https://github.com/earendil-works/pi/issues/5943)). - Fixed transient extension UI and session-start messages emitted during session replacement or reload so they remain visible, and kept reload input blocked until reload completes ([#5943](https://github.com/earendil-works/pi/issues/5943)).
+18 -11
View File
@@ -221,17 +221,24 @@ export function createFindToolDefinition(
return; return;
} }
// Build fd arguments. --no-require-git makes fd apply hierarchical .gitignore const args: string[] = ["--glob", "--color=never", "--hidden"];
// semantics whether or not the search path is inside a git repository, without
// leaking sibling-directory rules the way --ignore-file (a global source) would. // fd normally ignores .gitignore outside git repos, so keep --no-require-git
const args: string[] = [ // there. Inside repos, use fd's default git-aware behavior so parent
"--glob", // .gitignore rules stop at nested repo boundaries:
"--color=never", // https://github.com/earendil-works/pi/issues/5960
"--hidden", let insideGitRepo = false;
"--no-require-git", for (let current = searchPath; ; ) {
"--max-results", if (await pathExists(path.join(current, ".git"))) {
String(effectiveLimit), insideGitRepo = true;
]; break;
}
const parent = path.dirname(current);
if (parent === current) break;
current = parent;
}
if (!insideGitRepo) args.push("--no-require-git");
args.push("--max-results", String(effectiveLimit));
// fd --glob matches against the basename unless --full-path is set; in --full-path // fd --glob matches against the basename unless --full-path is set; in --full-path
// mode it matches against the absolute candidate path, so a path-containing // mode it matches against the absolute candidate path, so a path-containing