Skip to content

Fix move-branch failing when base segment has no ref name#13602

Draft
mtsgrd wants to merge 1 commit intomasterfrom
fix-move-commit
Draft

Fix move-branch failing when base segment has no ref name#13602
mtsgrd wants to merge 1 commit intomasterfrom
fix-move-commit

Conversation

@mtsgrd
Copy link
Copy Markdown
Contributor

@mtsgrd mtsgrd commented May 1, 2026

Moving a branch onto another stack fails with "Graph base segment
doesn't have a ref name" when the source branch's base segment in the
graph is unnamed. This happens when origin/master advances past the
fork point where the branches diverge — the old fork point becomes an
unnamed intermediate segment in the graph, and the disconnect logic
assumed every base segment would carry a ref.

Remove the ref-name requirement from parent-disconnect selection.
A new select_segment helper tries the ref name first, then falls
back to the segment's tip commit. If neither exists (empty + unnamed),
it bails rather than silently selecting all parents.

The E2E test reproduces the scenario: two branches are applied, then
origin/master is advanced and fetched so the fork point loses its ref.
Moving one branch on top of the other exercises the fallback path.

Moving a branch onto another stack fails with "Graph base segment
doesn't have a ref name" when the source branch's base segment in the
graph is unnamed. This happens when origin/master advances past the
fork point where the branches diverge — the old fork point becomes an
unnamed intermediate segment in the graph, and the disconnect logic
assumed every base segment would carry a ref.

Remove the ref-name requirement from parent-disconnect selection.
A new `select_segment` helper tries the ref name first, then falls
back to the segment's tip commit. If neither exists (empty + unnamed),
it bails rather than silently selecting all parents.

The E2E test reproduces the scenario: two branches are applied, then
origin/master is advanced and fetched so the fork point loses its ref.
Moving one branch on top of the other exercises the fallback path.
@github-actions github-actions Bot added the rust Pull requests that update Rust code label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant