mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
address duplicate filtering and Combine predicates to reduce traversal
This commit is contained in:
parent
8031ae1877
commit
0b34253611
2 changed files with 8 additions and 3 deletions
|
|
@ -63,6 +63,8 @@ export class GitIgnoreController extends BaseIgnoreController {
|
|||
await this.findGitignoreFilesRecursively(this.cwd)
|
||||
|
||||
// Load any files discovered by recursion that weren't loaded yet
|
||||
// De-duplicate discovered paths to avoid redundant loads
|
||||
this.gitignoreFiles = Array.from(new Set(this.gitignoreFiles))
|
||||
for (const p of this.gitignoreFiles) {
|
||||
if (!this.gitignoreContents.has(p)) {
|
||||
await this.loadGitignoreFile(p)
|
||||
|
|
|
|||
|
|
@ -215,9 +215,12 @@ export async function regexSearchFiles(
|
|||
// console.log(results)
|
||||
|
||||
// Filter results using both controllers if provided
|
||||
const filteredResults = results
|
||||
.filter((result) => gitIgnoreController?.validateAccess(result.file) ?? true)
|
||||
.filter((result) => rooIgnoreController?.validateAccess(result.file) ?? true)
|
||||
const filteredResults = results.filter((result) => {
|
||||
const file = result.file
|
||||
return (
|
||||
(gitIgnoreController?.validateAccess(file) ?? true) && (rooIgnoreController?.validateAccess(file) ?? true)
|
||||
)
|
||||
})
|
||||
|
||||
return formatResults(filteredResults, cwd)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue