mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
fix: make bfsFileSearch more efficient (#8173)
This commit is contained in:
@@ -99,6 +99,16 @@ export async function bfsFileSearch(
|
|||||||
for (const { currentDir, entries } of results) {
|
for (const { currentDir, entries } of results) {
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
const fullPath = path.join(currentDir, entry.name);
|
const fullPath = path.join(currentDir, entry.name);
|
||||||
|
const isDirectory = entry.isDirectory();
|
||||||
|
const isMatchingFile = entry.isFile() && entry.name === fileName;
|
||||||
|
|
||||||
|
if (!isDirectory && !isMatchingFile) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isDirectory && ignoreDirsSet.has(entry.name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
fileService?.shouldIgnoreFile(fullPath, {
|
fileService?.shouldIgnoreFile(fullPath, {
|
||||||
respectGitIgnore: options.fileFilteringOptions?.respectGitIgnore,
|
respectGitIgnore: options.fileFilteringOptions?.respectGitIgnore,
|
||||||
@@ -109,11 +119,9 @@ export async function bfsFileSearch(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.isDirectory()) {
|
if (isDirectory) {
|
||||||
if (!ignoreDirsSet.has(entry.name)) {
|
queue.push(fullPath);
|
||||||
queue.push(fullPath);
|
} else {
|
||||||
}
|
|
||||||
} else if (entry.isFile() && entry.name === fileName) {
|
|
||||||
foundFiles.push(fullPath);
|
foundFiles.push(fullPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user