Skip to content

Commit 97ccafc

Browse files
fix(core): honor wildcard gitignore rules in FFF (anomalyco#43988)
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
1 parent 1864bc4 commit 97ccafc

6 files changed

Lines changed: 64 additions & 28 deletions

File tree

‎bun.lock‎

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,6 @@
176176
"@pierre/trees@1.0.0-beta.4": "patches/@pierre%2Ftrees@1.0.0-beta.4.patch",
177177
"@modelcontextprotocol/sdk@1.29.0": "patches/@modelcontextprotocol%2Fsdk@1.29.0.patch",
178178
"@tanstack/virtual-core@3.17.3": "patches/@tanstack%2Fvirtual-core@3.17.3.patch",
179-
"@ff-labs/fff-bun@0.10.1": "patches/@ff-labs%2Ffff-bun@0.10.1.patch"
179+
"@ff-labs/fff-bun@0.10.5": "patches/@ff-labs%2Ffff-bun@0.10.5.patch"
180180
}
181181
}

‎packages/cli/package.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858
"@lydell/node-pty-linux-x64": "1.2.0-beta.12",
5959
"@lydell/node-pty-win32-arm64": "1.2.0-beta.12",
6060
"@lydell/node-pty-win32-x64": "1.2.0-beta.12",
61-
"@ff-labs/fff-bin-darwin-arm64": "0.10.1",
62-
"@ff-labs/fff-bin-linux-arm64-gnu": "0.10.1",
63-
"@ff-labs/fff-bin-linux-x64-gnu": "0.10.1",
64-
"@ff-labs/fff-bin-win32-arm64": "0.10.1",
65-
"@ff-labs/fff-bin-win32-x64": "0.10.1",
61+
"@ff-labs/fff-bin-darwin-arm64": "0.10.5",
62+
"@ff-labs/fff-bin-linux-arm64-gnu": "0.10.5",
63+
"@ff-labs/fff-bin-linux-x64-gnu": "0.10.5",
64+
"@ff-labs/fff-bin-win32-arm64": "0.10.5",
65+
"@ff-labs/fff-bin-win32-x64": "0.10.5",
6666
"@yuuang/ffi-rs-darwin-arm64": "1.3.2",
6767
"@yuuang/ffi-rs-linux-arm64-gnu": "1.3.2",
6868
"@yuuang/ffi-rs-linux-x64-gnu": "1.3.2",

‎packages/core/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@
113113
"@aws-sdk/credential-providers": "3.1057.0",
114114
"@lydell/node-pty": "catalog:",
115115
"@modelcontextprotocol/sdk": "1.29.0",
116-
"@ff-labs/fff-bun": "0.10.1",
117-
"@ff-labs/fff-node": "0.10.1",
116+
"@ff-labs/fff-bun": "0.10.5",
117+
"@ff-labs/fff-node": "0.10.5",
118118
"@opencode-ai/codemode": "workspace:*",
119119
"@opencode-ai/ai": "workspace:*",
120120
"@opencode-ai/schema": "workspace:*",

‎packages/core/test/filesystem/search.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, spyOn, test } from "bun:test"
22
import fuzzysort from "fuzzysort"
3+
import { mkdir, mkdtemp, rm } from "node:fs/promises"
34
import os from "os"
45
import path from "path"
56
import { Deferred, Effect, Layer } from "effect"
@@ -14,6 +15,41 @@ import { AbsolutePath, RelativePath } from "@opencode-ai/core/schema"
1415
import { location } from "../fixture/location"
1516

1617
describe("FileSystemSearch", () => {
18+
test("honors wildcard directory rules from .gitignore", async () => {
19+
const directory = await mkdtemp(path.join(os.tmpdir(), "opencode-fff-ignore-"))
20+
try {
21+
await mkdir(path.join(directory, "rust/target/debug/deps"), { recursive: true })
22+
await Bun.write(path.join(directory, ".gitignore"), "**/target/\n")
23+
await Bun.write(path.join(directory, "rust/target/debug/deps/ignored.rs"), "ignored")
24+
const git = Bun.spawnSync(["git", "init", "-q"], { cwd: directory })
25+
expect(git.exitCode).toBe(0)
26+
27+
const ref = Location.Ref.make({ directory: AbsolutePath.make(directory) })
28+
const layer = FileSystemSearch.fffLayer.pipe(
29+
Layer.provide(
30+
Layer.succeed(
31+
Location.Service,
32+
Location.Service.of(
33+
location(ref, {
34+
vcs: { type: "git", store: AbsolutePath.make(path.join(directory, ".git")) },
35+
}),
36+
),
37+
),
38+
),
39+
)
40+
const entries = await Effect.runPromise(
41+
Effect.gen(function* () {
42+
const search = yield* FileSystemSearch.Service
43+
return yield* search.find({ query: "target" })
44+
}).pipe(Effect.provide(layer), Effect.scoped),
45+
)
46+
47+
expect(entries.every((entry) => !entry.path.startsWith("rust/target/"))).toBe(true)
48+
} finally {
49+
await rm(directory, { recursive: true, force: true })
50+
}
51+
})
52+
1753
test("bounds a home scan even when home is detected as a repository", async () => {
1854
let observed: Ripgrep.FindInput | undefined
1955
const home = AbsolutePath.make(os.homedir())

0 commit comments

Comments
 (0)