You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There were some tests that only asserted metadata. I don't think we should need to assert metadata at this level, so I've changed it to assert workspace outcomes.
Note
High Risk
Changes core branch creation, reordering, and HEAD checkout across API, transactions, and rebase materialization—behavior users depend on for stack projection and ad-hoc workspaces.
Overview Branch create, move, and tear-off now run entirely through the graph rebase Editor and materialize, instead of overlay graph rebuilds plus separate metadata and checkout steps.
create_reference takes an Editor, places refs in the step graph (including independent stacks as parents of the workspace commit), and returns a SuccessfulRebase. API, transaction, action, and legacy virtual-branch callers were updated to use that path and drop the old new_stack_id / recording-metadata wrappers. Move/tear-off no longer return Outcome with branch_stack_order and new_tip; ad-hoc reordering updates HEAD via new set_head_checkout so materialization keeps the stack projected. Related editor work adds insert_parent, workspace ref/commit selectors, and stricter HEAD checkout change detection.
Graph init adjusts ad-hoc segment splitting at the target (unnamed segments get ref metadata before split). Tests now assert workspace graphs and HEAD rather than persisted branch-order metadata alone.
Reviewed by Cursor Bugbot for commit 99bf5b1. Bugbot is set up for automated code reviews on this repo. Configure here.
The reason will be displayed to describe this comment to others. Learn more.
Preserve the full order before checking out the new tip
When an ad-hoc move takes the checked-out top branch downward (for example, C above A producing B, C, A), this outcome no longer carries new_order. The rebase is materialized while its checkout selector still points to C, so SuccessfulRebase::branch_stacks() sees only C, A and replaces the persisted chain with that truncated order; the API and transaction paths check out B only afterward, without re-persisting metadata. This breaks the existing contract that the successful move persists B, C, A, and can lose ordering that Git cannot reconstruct for empty branches. Preserve the computed order until materialization, or make the rebase checkout follow new_tip before branch stacks are recorded.
The reason will be displayed to describe this comment to others. Learn more.
Retain the remaining stack when tearing off HEAD
When the torn-off branch is the current ad-hoc checkout, this branch makes it independent but leaves the editor checkout on that branch. Materialization therefore derives only the singleton checked-out stack, and set_branch_stack_order([subject]) replaces the former chain, deleting the order of all branches left behind; with an empty C, B, A chain, tearing off C loses the otherwise non-reconstructible B, A order. The removed code explicitly persisted the old chain minus the subject, so that remaining order still needs to be supplied or otherwise recorded.
Ad-hoc relative placement now succeeds even when M::can_persist_branch_stack_order() is false. BranchStacks::persist skips ad-hoc order in that case (but-rebase/src/graph_rebase/branch_stacks.rs:93-101), so two refs placed on the same commit lose their relative order as soon as the workspace is reloaded. The removed requires_branch_order_metadata test previously guarded this exact case, and move_branch_in_single_branch_mode still rejects it. Restore that precondition for placements whose ordering is not representable in Git, or provide another durable encoding before creating the ref.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
The reason will be displayed to describe this comment to others. Learn more.
Workspace commit creation drops stacks
High Severity
ensure_workspace_commit runs for every create_reference, including dependent placement, and a minted workspace commit only parents below. branch_stacks persist then records only those parents, so other applied stacks can disappear from the workspace.
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
CLIThe command-line program `but`rustPull requests that update Rust code
3 participants
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.
There were some tests that only asserted metadata. I don't think we should need to assert metadata at this level, so I've changed it to assert workspace outcomes.
Note
High Risk
Changes core branch creation, reordering, and HEAD checkout across API, transactions, and rebase materialization—behavior users depend on for stack projection and ad-hoc workspaces.
Overview
Branch create, move, and tear-off now run entirely through the graph rebase
Editorandmaterialize, instead of overlay graph rebuilds plus separate metadata and checkout steps.create_referencetakes anEditor, places refs in the step graph (including independent stacks as parents of the workspace commit), and returns aSuccessfulRebase. API, transaction, action, and legacy virtual-branch callers were updated to use that path and drop the oldnew_stack_id/ recording-metadata wrappers. Move/tear-off no longer returnOutcomewithbranch_stack_orderandnew_tip; ad-hoc reordering updatesHEADvia newset_head_checkoutso materialization keeps the stack projected. Related editor work addsinsert_parent, workspace ref/commit selectors, and stricter HEAD checkout change detection.Graph init adjusts ad-hoc segment splitting at the target (unnamed segments get ref metadata before split). Tests now assert workspace graphs and
HEADrather than persisted branch-order metadata alone.Reviewed by Cursor Bugbot for commit 99bf5b1. Bugbot is set up for automated code reviews on this repo. Configure here.