mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
fix: don't --follow by default for grep and other things using ripgrep (#11415)
This commit is contained in:
@@ -214,8 +214,8 @@ export namespace Ripgrep {
|
|||||||
input.signal?.throwIfAborted()
|
input.signal?.throwIfAborted()
|
||||||
|
|
||||||
const args = [await filepath(), "--files", "--glob=!.git/*"]
|
const args = [await filepath(), "--files", "--glob=!.git/*"]
|
||||||
if (input.follow !== false) args.push("--follow")
|
if (input.follow) args.push("--follow")
|
||||||
if (input.hidden !== false) args.push("--hidden")
|
if (input.hidden) args.push("--hidden")
|
||||||
if (input.maxDepth !== undefined) args.push(`--max-depth=${input.maxDepth}`)
|
if (input.maxDepth !== undefined) args.push(`--max-depth=${input.maxDepth}`)
|
||||||
if (input.glob) {
|
if (input.glob) {
|
||||||
for (const g of input.glob) {
|
for (const g of input.glob) {
|
||||||
@@ -381,7 +381,7 @@ export namespace Ripgrep {
|
|||||||
follow?: boolean
|
follow?: boolean
|
||||||
}) {
|
}) {
|
||||||
const args = [`${await filepath()}`, "--json", "--hidden", "--glob='!.git/*'"]
|
const args = [`${await filepath()}`, "--json", "--hidden", "--glob='!.git/*'"]
|
||||||
if (input.follow !== false) args.push("--follow")
|
if (input.follow) args.push("--follow")
|
||||||
|
|
||||||
if (input.glob) {
|
if (input.glob) {
|
||||||
for (const g of input.glob) {
|
for (const g of input.glob) {
|
||||||
|
|||||||
@@ -37,15 +37,7 @@ export const GrepTool = Tool.define("grep", {
|
|||||||
await assertExternalDirectory(ctx, searchPath, { kind: "directory" })
|
await assertExternalDirectory(ctx, searchPath, { kind: "directory" })
|
||||||
|
|
||||||
const rgPath = await Ripgrep.filepath()
|
const rgPath = await Ripgrep.filepath()
|
||||||
const args = [
|
const args = ["-nH", "--hidden", "--no-messages", "--field-match-separator=|", "--regexp", params.pattern]
|
||||||
"-nH",
|
|
||||||
"--hidden",
|
|
||||||
"--follow",
|
|
||||||
"--no-messages",
|
|
||||||
"--field-match-separator=|",
|
|
||||||
"--regexp",
|
|
||||||
params.pattern,
|
|
||||||
]
|
|
||||||
if (params.include) {
|
if (params.include) {
|
||||||
args.push("--glob", params.include)
|
args.push("--glob", params.include)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user