fix(scripts/pr): make cleanup worktree-safe

This commit is contained in:
Gustavo Madeira Santana
2026-03-31 09:06:24 -04:00
parent 27b9665871
commit 8dbba7d17c
3 changed files with 186 additions and 9 deletions

View File

@@ -131,10 +131,10 @@ gc_pr_worktrees() {
if [ "$dry_run" = "true" ]; then
echo "would remove $dir (PR #$pr state=$state)"
else
git worktree remove "$dir" --force
git branch -D "temp/pr-$pr" 2>/dev/null || true
git branch -D "pr-$pr" 2>/dev/null || true
git branch -D "pr-$pr-prep" 2>/dev/null || true
remove_worktree_if_present "$dir"
delete_local_branch_if_safe "temp/pr-$pr"
delete_local_branch_if_safe "pr-$pr"
delete_local_branch_if_safe "pr-$pr-prep"
echo "removed $dir (PR #$pr state=$state)"
fi
removed=$((removed + 1))