fix(merge): Accept merge-shaped fast-forward histories - #3509
Conversation
Recognize source tips that already contain the target as exact-shape merge candidates while retaining divergence checks and autostash restoration. Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
|
@worktrunk-bot what does this PR do? Why is it an improvement? |
|
This PR loosens the What changed. Why it's an improvement. The linearity check conflated two independent properties. A merge commit in wt merge main --no-commit --no-rebase --no-remove --no-hooks
# ✗ Branch not rebased onto main ← even though main is an ancestorThe two properties that should block the merge are retained, because they both make the target a non-ancestor: divergence (the target advanced past the merge-base) and unrelated history (no merge-base at all) still fail with The main use case is promoting independently-assembled history (e.g. agentic coding runs that produce internal merges) without flattening it. Verification notes
|
|
how does it compare to git's handling of similar flags, for example in |
|
Good question — the change moves Where it now matches git. Git's fast-forward decision ( The mapping.
Where it deliberately stays stricter than git. The ancestor check sits above the Put differently: git's |
|
does it do a rebase when |
|
No — The So the graph produced by the earlier commit/squash stages is preserved verbatim — the check only asserts it's already fast-forwardable. This matches the step-3 docs: "With (One nuance: the earlier commit/squash stages can still rewrite commits — |
Highlights: clickable CI and dev-server-URL statusline segments in Claude Code (#3550), `wt merge --no-rebase` accepting merge-shaped fast-forward histories (#3509), a faster and lower-CPU `wt switch` picker (#3544, #3534), and SignPath code signing for the Windows release binary (#3553). Full details in CHANGELOG.md. > _This was written by Claude Code on behalf of max_
🧢 Changes
--no-commit --no-rebaseand--no-ff --no-rebase.☕️ Reasoning
--no-rebaseused a linear-history predicate that rejected any source rangecontaining a merge commit. Git can safely fast-forward to such a tip when the
target is already its ancestor.
This blocked real-world agentic coding integration: independently assembled
history could not be promoted without either rewriting the graph or using a raw
Git fallback.
🧪 Reproduction
From a clean source branch containing an internal merge, with
mainas anancestor:
Before this fix:
✅ Verification
Developed with carefully directed, manually reviewed AI assistance.
Co-Authored-By: GPT-5.6 Sol codex@openai.com