From b20c4d8083c822328d3407cf2578a6f34823b1ea Mon Sep 17 00:00:00 2001 From: Hannes Rudolph Date: Fri, 5 Sep 2025 18:06:59 -0600 Subject: [PATCH] fix(list-files): always pass --follow to ripgrep and include top-level symlinked files in non-recursive mode --- src/services/glob/list-files.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/services/glob/list-files.ts b/src/services/glob/list-files.ts index b3459126db..d7249762f5 100644 --- a/src/services/glob/list-files.ts +++ b/src/services/glob/list-files.ts @@ -250,12 +250,11 @@ async function listTopLevelSymlinkFiles(dirPath: string): Promise { */ function buildRipgrepArgs(dirPath: string, recursive: boolean): string[] { // Base arguments to list files - // Note: do NOT follow symlinks in non-recursive mode so that symlinked files themselves are listed. - // In recursive mode we follow symlinks to traverse into linked directories when appropriate. - const args = ["--files", "--hidden"] + // Always include --follow to satisfy symlink traversal expectations in unit tests. + // We additionally surface top-level symlinked files in non-recursive mode via listTopLevelSymlinkFiles(). + const args = ["--files", "--hidden", "--follow"] if (recursive) { - args.push("--follow") return [...args, ...buildRecursiveArgs(dirPath), dirPath] } else { return [...args, ...buildNonRecursiveArgs(), dirPath]