summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-12-09 15:41:31 -0500
committerDax Raad <[email protected]>2025-12-09 15:41:38 -0500
commitf1955b4d05f934b08b200c165b13ed2369e1befe (patch)
treed61f4da116cee46a33854018a06ad4bc50adfe07
parentc5e5627cbd22f8b46d6422f3caeb0cbf143e076e (diff)
downloadopencode-f1955b4d05f934b08b200c165b13ed2369e1befe.tar.gz
opencode-f1955b4d05f934b08b200c165b13ed2369e1befe.zip
core: fix project event emission to include updated worktree data
-rw-r--r--packages/opencode/src/project/project.ts9
-rw-r--r--packages/opencode/test/snapshot/snapshot.test.ts2
2 files changed, 6 insertions, 5 deletions
diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts
index 4e71032aa..e97ff1ad5 100644
--- a/packages/opencode/src/project/project.ts
+++ b/packages/opencode/src/project/project.ts
@@ -108,7 +108,7 @@ export namespace Project {
}
}
discover(existing)
- await Storage.write<Info>(["project", id], {
+ const result: Info = {
...existing,
worktree,
vcs: vcs as Info["vcs"],
@@ -116,14 +116,15 @@ export namespace Project {
...existing.time,
updated: Date.now(),
},
- })
+ }
+ await Storage.write<Info>(["project", id], result)
GlobalBus.emit("event", {
payload: {
type: Event.Updated.type,
- properties: existing,
+ properties: result,
},
})
- return existing
+ return result
}
export async function discover(input: Info) {
diff --git a/packages/opencode/test/snapshot/snapshot.test.ts b/packages/opencode/test/snapshot/snapshot.test.ts
index 11eeaab72..cf933f812 100644
--- a/packages/opencode/test/snapshot/snapshot.test.ts
+++ b/packages/opencode/test/snapshot/snapshot.test.ts
@@ -469,7 +469,7 @@ test("snapshot state isolation between projects", async () => {
})
})
-test.only("patch detects changes in secondary worktree", async () => {
+test("patch detects changes in secondary worktree", async () => {
await using tmp = await bootstrap()
const worktreePath = `${tmp.path}-worktree`
await $`git worktree add ${worktreePath} HEAD`.cwd(tmp.path).quiet()