Skip to content

Commit b0c817b

Browse files
rekram1-nodeishaksebsib
authored andcommitted
fix: don't --follow by default for grep and other things using ripgrep (anomalyco#11415)
1 parent fc78aea commit b0c817b

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

packages/opencode/src/file/ripgrep.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ export namespace Ripgrep {
214214
input.signal?.throwIfAborted()
215215

216216
const args = [await filepath(), "--files", "--glob=!.git/*"]
217-
if (input.follow !== false) args.push("--follow")
218-
if (input.hidden !== false) args.push("--hidden")
217+
if (input.follow) args.push("--follow")
218+
if (input.hidden) args.push("--hidden")
219219
if (input.maxDepth !== undefined) args.push(`--max-depth=${input.maxDepth}`)
220220
if (input.glob) {
221221
for (const g of input.glob) {
@@ -381,7 +381,7 @@ export namespace Ripgrep {
381381
follow?: boolean
382382
}) {
383383
const args = [`${await filepath()}`, "--json", "--hidden", "--glob='!.git/*'"]
384-
if (input.follow !== false) args.push("--follow")
384+
if (input.follow) args.push("--follow")
385385

386386
if (input.glob) {
387387
for (const g of input.glob) {

packages/opencode/src/tool/grep.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,7 @@ export const GrepTool = Tool.define("grep", {
3737
await assertExternalDirectory(ctx, searchPath, { kind: "directory" })
3838

3939
const rgPath = await Ripgrep.filepath()
40-
const args = [
41-
"-nH",
42-
"--hidden",
43-
"--follow",
44-
"--no-messages",
45-
"--field-match-separator=|",
46-
"--regexp",
47-
params.pattern,
48-
]
40+
const args = ["-nH", "--hidden", "--no-messages", "--field-match-separator=|", "--regexp", params.pattern]
4941
if (params.include) {
5042
args.push("--glob", params.include)
5143
}

0 commit comments

Comments
 (0)