fix(core): reuse location git repository

This commit is contained in:
Aiden Cline 2026-07-22 10:29:39 -05:00
commit d54d26acd6
5 changed files with 18 additions and 5 deletions

View file

@ -3,12 +3,18 @@ import { Effect, Layer } from "effect"
import { AppNodeBuilder } from "@opencode-ai/core/effect/app-node-builder"
import { Location } from "@opencode-ai/core/location"
import { Project } from "@opencode-ai/core/project"
import { Git } from "@opencode-ai/core/git"
import { AbsolutePath } from "@opencode-ai/core/schema"
import { WorkspaceV2 } from "@opencode-ai/core/workspace"
import { testEffect } from "./lib/effect"
const workspaceID = WorkspaceV2.ID.make("wrk_test")
const ref = { directory: AbsolutePath.make("/repo/packages/app"), workspaceID }
const repository = new Git.Repository({
worktree: AbsolutePath.make("/repo"),
gitDirectory: AbsolutePath.make("/repo/.git"),
commonDirectory: AbsolutePath.make("/repo/.git"),
})
const projectLayer = Layer.succeed(
Project.Service,
Project.Service.of({
@ -19,6 +25,7 @@ const projectLayer = Layer.succeed(
id: Project.ID.make("project"),
directory: AbsolutePath.make("/repo"),
vcs: { type: "git", store: AbsolutePath.make("/repo/.git") },
repository,
}),
commit: () => Effect.void,
}),
@ -38,6 +45,7 @@ describe("Location", () => {
type: "git",
store: AbsolutePath.make("/repo/.git"),
})
expect(location.repository).toBe(repository)
}),
)
})