Browse Source

core: prevent sessions from disappearing after git init

Previously, sessions created in a non-git directory would disappear from
the session picker after running git init and making the first commit.
This happened because the migration logic ran prematurely before a stable
project ID existed.
Aiden Cline 2 months ago
parent
commit
aa884b003e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/opencode/src/project/project.ts

+ 1 - 1
packages/opencode/src/project/project.ts

@@ -80,7 +80,7 @@ export namespace Project {
       .then((x) => path.resolve(worktree, x.trim()))
     const projectID = id || "global"
     const existing = id ? await Storage.read<Info>(["project", id]).catch(() => undefined) : undefined
-    if (!existing) {
+    if (!existing && id) {
       await migrateFromGlobal(projectID, worktree)
     }
     const project: Info = {