Skip to content

fix(list): report the tracked remote branch in schema-1 JSON remote.branch - #4756

Merged
max-sixty merged 1 commit into
mainfrom
nightly/clean-42768363059
Nov 10, 2026
Merged

max-sixty merged 1 commit into
mainfrom
nightly/clean-42768363059

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

wt list --format=json (schema 1) and wt list statusline --format=json reported the local branch name in remote.branch. So a local feature tracking origin/other-name serialized "branch": "feature", even though the field is documented as the remote branch name. Schema 2's upstream.branch already reports other-name for the same row, so the two schemas disagreed.

upstream_to_json has a comment saying UpstreamStatus only stores the remote name. That stopped being true once the field began carrying the upstream's short name (upstream_short, set in compute_upstream). The fix reads ActiveUpstream::branch, which is the same value schema 2 uses. It falls back to the local name only when the upstream short name is unknown, so output for rows without one doesn't change.

A new unit test (test_upstream_to_json_reports_tracked_branch_name) fails on main with left: "feature", right: "other-name" and passes with the fix. The existing list and statusline integration tests pass unchanged, because none of them track a remote branch under a different name.

Found by the nightly survey.

…ranch

Schema-1 `remote.branch` serialized the local branch name, so a local
`feature` tracking `origin/other-name` reported "feature". UpstreamStatus
has carried the upstream's short name since the field's comment was
written; use the remote-side name, as schema 2's `upstream.branch` does,
falling back to the local name only when the upstream name is unknown.
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Nov 10, 2026
@max-sixty
max-sixty merged commit 2271c34 into main Nov 10, 2026
36 of 45 checks passed
@max-sixty
max-sixty deleted the nightly/clean-42768363059 branch November 10, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants