Repository navigation
fix(step): diff against the target's upstream when the local target is stale - #4281
Merged
Merged
Conversation
…s stale `wt step diff` diffed from merge-base(HEAD, target). When a branch is built on origin/main and local main lags it, that merge base is local main itself, so the diff counted every upstream commit the branch sits on as the branch's own. `wt merge`, `wt step squash`, and `wt step rebase` already measure against the upstream in this topology (#3549, via `span_upstream`); `wt step diff`, whose help promises "what `wt merge` would include", now does too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
Sep 26, 2026
1 task
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.
wt step diffdiffed frommerge-base(HEAD, target). When a branch is built onorigin/mainand localmainlags it, that merge base is localmainitself, so the diff counted every upstream commit the branch sits on as the branch's own. In the case that surfaced this, a one-commit branch 9 commits ahead of a stale localmainshowed 39 files instead of its 3.#3549 fixed this topology for
wt merge,wt step squashandwt step rebaseviaspan_upstream, butwt step diffwas left out, even though its help says it shows "whatwt mergewould include". It now uses the same rule, so its diff matches whatwt mergewould squash and what thewt listcolumns and picker diff pane already measure against. Explicit targets with no upstream (origin/main, a SHA) are unchanged.The new test sits with the other #3519 tests in
merge.rsand reuses their stale-mainfixture. With the fix reverted, it fails and lists the upstream commits' files.