MCPcopy Index your code
hub / github.com/generalaction/emdash / openWorktree

Method openWorktree

packages/core/src/git/git-runtime.ts:163–190  ·  view source on GitHub ↗
(worktreePath: string)

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 8

assertOpenMethod · 0.95
resolveIdentityMethod · 0.95
acquireRepositoryMethod · 0.95
readyMethod · 0.95
disposeMethod · 0.95
acquireMethod · 0.65
releaseMethod · 0.65
withCwdMethod · 0.45

Tested by

no test coverage detected