MCPcopy Index your code
hub / github.com/garrytan/gstack / cleanup

Method cleanup

lib/worktree.ts:215–230  ·  view source on GitHub ↗

Remove a worktree. Non-fatal on error.

(testName: string)

Source from the content-addressed store, hash-verified

213
214 /** Remove a worktree. Non-fatal on error. */
215 cleanup(testName: string): void {
216 const info = this.active.get(testName);
217 if (!info) return;
218
219 try {
220 git(['worktree', 'remove', '--force', info.path], this.repoRoot, true);
221 } catch {
222 // Force remove the directory if git worktree remove fails
223 try {
224 fs.rmSync(info.path, { recursive: true, force: true });
225 git(['worktree', 'prune'], this.repoRoot, true);
226 } catch { /* non-fatal */ }
227 }
228
229 this.active.delete(testName);
230 }
231
232 /** Force-remove all active worktrees (for process exit handler). */
233 cleanupAll(): void {

Calls 2

gitFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected