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.
This commit is contained in:
Aiden Cline 2025-12-06 23:32:47 -06:00
parent e0f77940f9
commit aa884b003e

View file

@ -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 = {