Skip child action prompt when removing branches with no children #382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✅ Fix: Skip child action prompt when removing branches with no children
Issue Resolved Successfully
Fixed the
branch removecommand to skip asking about child branch actions when the branch being removed has no children.✅ Implementation Complete:
RemoveBranchCommandHandlerto check if branch has children before promptingFindBranch()method to Stack.cs for efficient branch lookup--remove-childrenand--move-children-to-parentwork as expectedRemoveBranchChildAction.RemoveChildrenwhen no children and no explicit action✅ Testing Complete:
WhenBranchHasNoChildren_DoesNotAskForChildAction()WhenBranchHasNoChildrenButRemoveChildrenIsProvided_DoesNotAskForChildAction()WhenBranchHasNoChildrenButMoveChildrenToParentIsProvided_DoesNotAskForChildAction()✅ Technical Implementation:
Files Changed:
src/Stack/Config/Stack.cs- Added branch lookup methodssrc/Stack/Commands/Branch/RemoveBranchCommand.cs- Modified handler logicsrc/Stack.Tests/Commands/Branch/RemoveBranchCommandHandlerTests.cs- Added comprehensive tests, removed redundant coverageKey Logic:
✅ Acceptance Criteria Met:
✅ When branch has no children, user is not asked for child action
✅ CLI flags
--remove-childrenand--move-children-to-parentstill work✅ Unit tests added covering all scenarios
✅ Redundant test coverage removed per review feedback
Ready for Review - The fix is minimal, well-tested, and addresses all feedback.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.