(worktreePath: string)
| 161 | } |
| 162 | |
| 163 | async openWorktree(worktreePath: string): Promise<WorktreeLease> { |
| 164 | this.assertOpen(); |
| 165 | const identity = await this.resolveIdentity(worktreePath); |
| 166 | const lease = await this.worktrees.acquire(identity.topLevel, async () => { |
| 167 | const repositoryLease = await this.acquireRepository(identity); |
| 168 | try { |
| 169 | const worktree = new GitWorktree({ |
| 170 | worktree: identity.topLevel, |
| 171 | gitDir: identity.gitDir, |
| 172 | repository: repositoryLease.value, |
| 173 | exec: this.exec.withCwd(identity.topLevel), |
| 174 | watcher: this.watcher, |
| 175 | onError: this.onError, |
| 176 | }); |
| 177 | try { |
| 178 | await worktree.ready(); |
| 179 | } catch (error) { |
| 180 | await worktree.dispose(); |
| 181 | throw error; |
| 182 | } |
| 183 | return { worktree, repositoryLease }; |
| 184 | } catch (error) { |
| 185 | await repositoryLease.release(); |
| 186 | throw error; |
| 187 | } |
| 188 | }); |
| 189 | return { value: lease.value.worktree, release: lease.release }; |
| 190 | } |
| 191 | |
| 192 | async dispose(): Promise<void> { |
| 193 | this.disposeRequested = true; |
nothing calls this directly
no test coverage detected