mirror of
https://github.com/obra/superpowers.git
synced 2026-04-17 03:12:41 +00:00
feat(finishing-a-development-branch): add Step 5 cleanup guard (PRI-823)
Re-detect externally managed worktree at cleanup time and skip removal. Also fixes pre-existing inconsistency: cleanup now correctly says Options 1 and 4 only, matching Quick Reference and Common Mistakes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -179,7 +179,16 @@ Then: Cleanup worktree (Step 5)
|
||||
|
||||
### Step 5: Cleanup Worktree
|
||||
|
||||
**For Options 1, 2, 4:**
|
||||
**First, check if worktree is externally managed:**
|
||||
|
||||
````bash
|
||||
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
||||
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
||||
````
|
||||
|
||||
If `GIT_DIR` differs from `GIT_COMMON`: skip worktree removal — the host environment owns this workspace.
|
||||
|
||||
**Otherwise, for Options 1 and 4:**
|
||||
|
||||
Check if in worktree:
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user