You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(worktree): prevent primary worktree deletion on cleanup (#391)
* fix(worktree): prevent primary worktree deletion when base repo is also in repos config
When the base repo (mgmt) is listed in .mitzo.json repos as a secondary,
discoverSessionWorktrees adds both "primary" and "mgmt" entries pointing
to the same worktree. On session cleanup, cleanupSessionWorktrees skips
"primary" but removes "mgmt" — destroying the primary worktree and
breaking resume with "Path does not exist" errors.
Fix at two layers:
- discoverSessionWorktrees: skip secondary repos matching primaryRepo
- cleanupSessionWorktrees: guard against removing secondaries whose path
matches the primary worktree (defense in depth)
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix(worktree): normalize paths with resolve() before dedup comparison
Address Centaur review: string equality could miss trailing slashes,
symlinks, or relative vs absolute paths. Use path.resolve() in both
discoverSessionWorktrees and cleanupSessionWorktrees guards.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix(worktree): add trailing-slash dedup test, trim comment
Address second Centaur review: add test validating resolve()-based
dedup handles trailing slash differences, shorten redundant comment.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
0 commit comments