Skip to content

Prevent delete/rename of checked-out branches, add --force to detach#5

Merged
claybridges merged 5 commits into
mainfrom
prevent-delete
Apr 11, 2026
Merged

Prevent delete/rename of checked-out branches, add --force to detach#5
claybridges merged 5 commits into
mainfrom
prevent-delete

Conversation

@claybridges
Copy link
Copy Markdown
Owner

@claybridges claybridges commented Apr 11, 2026

Copilot instructions:

  • if you don't have anything to note that's not "overly picky", just silently approve please.

This comment was marked as outdated.

…ag cleanup

- In cmdRename, move conflict check before checkBranchesNotCheckedOut so a
  failed rename doesn't leave the user in detached HEAD state
- Use defer to reset forceFlag in tests so it's always cleaned up even on
  early failure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Owner Author

@claybridges claybridges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

This comment was marked as outdated.

branchesPreflight() is now side-effect-free: it checks worktrees and
the current branch, returning the branch to detach (or "") without
touching repo state. Callers detach HEAD immediately before the first
mutating operation, after all validation and user confirmation.

Also: fail closed on git symbolic-ref and git worktree list errors
instead of silently proceeding with empty/stale state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/git-folder/main.go Outdated
Comment thread cmd/git-folder/main_test.go
@claybridges claybridges merged commit 106d293 into main Apr 11, 2026
2 checks passed
@claybridges claybridges deleted the prevent-delete branch April 11, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants