(
projectPath: string,
workspacePath: string,
options: { force: boolean } = { force: false }
)
| 240 | } |
| 241 | |
| 242 | export async function removeWorktree( |
| 243 | projectPath: string, |
| 244 | workspacePath: string, |
| 245 | options: { force: boolean } = { force: false } |
| 246 | ): Promise<WorktreeResult> { |
| 247 | // Clean up stale lock before git operations on main repo |
| 248 | cleanStaleLock(projectPath); |
| 249 | |
| 250 | try { |
| 251 | // Remove the worktree (from the main repository context) |
| 252 | const args = ["-C", projectPath, "worktree", "remove", workspacePath]; |
| 253 | if (options.force) { |
| 254 | args.push("--force"); |
| 255 | } |
| 256 | using proc = execFileAsync("git", args); |
| 257 | await proc.result; |
| 258 | return { success: true }; |
| 259 | } catch (error) { |
| 260 | const message = getErrorMessage(error); |
| 261 | return { success: false, error: message }; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | export async function pruneWorktrees(projectPath: string): Promise<WorktreeResult> { |
| 266 | // Clean up stale lock before git operations on main repo |
nothing calls this directly
no test coverage detected