feat(workspace): WorktreeService with acquire/release state machine

This commit is contained in:
2026-05-02 08:03:30 +08:00
parent bd91880898
commit d76ed67666
6 changed files with 325 additions and 0 deletions
@@ -118,6 +118,13 @@ func (t *fakeTx) GetWorktreeByID(_ context.Context, id uuid.UUID) (*Worktree, er
}
return nil, &errsNotFound{}
}
func (t *fakeTx) GetWorktreeByIDForUpdate(_ context.Context, id uuid.UUID) (*Worktree, error) {
if w, ok := t.f.wts[id]; ok {
cp := *w
return &cp, nil
}
return nil, &errsNotFound{}
}
func (t *fakeTx) InsertWorktree(_ context.Context, w *Worktree) (*Worktree, error) {
cp := *w
t.f.wts[w.ID] = &cp