fix: ensure opencode still works if no commits present (#2363)

pull/2367/head
Aiden Cline 2025-09-01 19:57:14 -05:00 committed by GitHub
parent 0a01d20850
commit a431b8922c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -53,6 +53,17 @@ export namespace Project {
.map((x) => x.trim())
.toSorted(),
)
if (!id) {
const project: Info = {
id: "global",
worktree: "/",
time: {
created: Date.now(),
},
}
await Storage.write<Info>(["project", "global"], project)
return project
}
worktree = path.dirname(
await $`git rev-parse --path-format=absolute --git-common-dir`
.quiet()