Skip to content

fix(git): parse worktree-side status renames - #4190

Merged
max-sixty merged 1 commit into
max-sixty:mainfrom
Duang777:fix/parse-worktree-status-renames
Sep 19, 2026
Merged

max-sixty merged 1 commit into
max-sixty:mainfrom
Duang777:fix/parse-worktree-status-renames

Conversation

@Duang777

Copy link
Copy Markdown
Contributor

Summary

  • Treat R and C in either porcelain status column as two-path records.
  • Keep the parser aligned so later untracked paths are not skipped.
  • Add focused tests for worktree-side renames in both status parsers.

This is the small, independent parser fix extracted from #4112 after the request to split that PR.

Verification

  • Red check: both new tests fail with the old first-column-only condition.
  • cargo test --lib worktree_rename
  • cargo run -- hook pre-merge --yes (4,932 passed, 1 expected skipped)

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside this diff, parse_working_tree_status in src/commands/list/collect/tasks.rs carries the same first-column-only assumption: if index_status == 'R' { has_renamed = true; }, with 'R' in neither of the matches! arms above it. A R entry therefore sets no flag at all and WorkingTreeStatus::is_dirty() comes back false, so a worktree whose only change is a worktree-side rename renders as clean in wt list:

$ mv a.txt b.txt && git add -N b.txt
$ git status --porcelain
 R a.txt -> b.txt
$ wt list --format json | jq -c '.items[0].worktree.changes'
{"staged":false,"modified":false,"untracked":false,"renamed":false,"deleted":false,"conflicted":false,...}

That one is display-only — the removal and merge gates go through WorkingTree::is_dirty, which is a non-empty check over the raw porcelain, so no safety check is reading the flags.

Happy to push the flag mapping as a commit here, or leave it for a follow-up PR — whichever you'd prefer, given the request to keep this one narrow.

@max-sixty
max-sixty merged commit c23ce9c into max-sixty:main Sep 19, 2026
38 checks passed
@max-sixty max-sixty mentioned this pull request Sep 20, 2026
max-sixty added a commit that referenced this pull request Sep 20, 2026
0.79.0 was prepared and merged in #4181 but never tagged, so it never shipped.
Cargo.toml and Cargo.lock already carry the version, so this reuses it and folds
the thirteen commits that landed since into the same changelog section.

New entries cover the worktree-side rename fixes (#4190, #4191), the per-project
unknown-field warning (#4123), and the unterminated code fence in the picker's
preview (#4183, combined with #4178's column fix).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants