v0.2.28: ez create -m keeps parent fixed + full-subtree auto-restack fix#28
Merged
Conversation
…rent Stash uncommitted state, create the branch+worktree at the parent's unchanged tip, then pop the stash into the new worktree and commit there. Reject -m with --no-worktree. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ren (v0.2.28) ez commit/amend/move only restacked direct children (state.children_of), so after a commit on a mid-stack branch every descendant beyond the first level was left detached — parent_head still recorded the old parent tip and ez log showed the stack as healthy, but a later mutation on the grandchild lost the parent's changes until a manual ez restack. Add StackState::descendants_topo (full transitive subtree, parents before children) and a shared restack::cascade_restack helper that walks it; route commit, amend, and move through it. Because each parent is restacked before its children, one pass converges the whole subtree. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Two changes, released as v0.2.28.
1. `ez create -m` no longer advances the parent
Previously `ez create -m` committed on the current branch before forking, advancing the parent as a side effect. Now it stashes uncommitted state, creates the branch + worktree at the parent's unchanged tip, pops the stash into the new worktree, and commits there. `-m` with `--no-worktree` is rejected (the staged changes need somewhere to live).
2. Fix stale-`parent_head` auto-restack bug
`ez commit` / `ez amend` / `ez move` only restacked direct children (`state.children_of`). After a commit on a mid-stack branch, every descendant beyond the first level was left detached — `parent_head` still recorded the old parent tip and `ez log` rendered the stack as healthy, but a later mutation on the grandchild landed on the orphaned line and lost the parent's changes until a manual `ez restack`. This violated design principle #2 ("auto-restack on every mutation… users should never have to think about rebasing").
Fix: added `StackState::descendants_topo` (full transitive subtree, parents before children) and a shared `restack::cascade_restack` helper that walks it; routed commit/amend/move through it. Because each parent is restacked before its children, a single pass converges the whole subtree. This also de-duplicates four near-identical restack loops.
Tests
🤖 Generated with Claude Code