Repository navigation
feat(error): list dirty files in UncommittedChanges - #2653
Merged
Merged
Conversation
`UncommittedChanges` now carries the `git status --porcelain` lines and renders them as a dim, indented block between the title and the hint, so "feature has uncommitted changes" tells the user *which* files. Plumbed through `WorkingTree::ensure_clean` (a new `dirty_files()` helper runs porcelain once and returns the lines) and the `--no-commit` validator in `wt merge`. Empty vec is allowed; the field is additive. Affects every ensure_clean caller — merge cleanup, remove, promote main + target — plus `wt merge --no-commit` validation. No new git subprocesses: `is_dirty()` already ran porcelain; we just stop discarding its output on the failure path. Side benefit: surfaces what dirty state caused a flaky-test report. When `test_readme_example_complex` flakes locally with "feature-auth has uncommitted changes" mid-merge, the failing snapshot will now contain the exact file list — likely an OS metadata file (`.DS_Store`, fsmonitor artifact) rather than a worktrunk bug. See INVESTIGATION.md (untracked, local). Co-Authored-By: Claude <[email protected]>
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
One nit on the new test case — see inline.
Per review on #2653: the four other cases in this test use inline `@"..."` snapshots; the new fifth case was left as `assert_snapshot!(err.render())` which made cargo-insta materialize an external `.snap` under `src/git/snapshots/`. Per `tests/CLAUDE.md` ("Inline snapshots over multi-assert"), inline is the convention. Drops the external file too. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
May 9, 2026
max-sixty
added a commit
that referenced
this pull request
May 10, 2026
Bump worktrunk to **0.49.0** — minor bump (semver-checks reports a
breaking change in `GitError::UncommittedChanges`, which gained a
`dirty_files: Vec<String>` field).
## Highlights
**Improved**
- New `codename(n)` template filter — deterministic friendly worktree
names from a ~1.26M-combo pool (`{{ branch | codename(2) }}` →
`malleable-opah`).
[#2641](#2641), thanks
@endigma
- Picker preview disk cache for Log / BranchDiff / UpstreamDiff, with
background refresh for stale Log decorations.
[#2628](#2628),
[#2646](#2646)
- Picker shares one `default_branch_sha` lookup across BranchDiff items
instead of forking N rev-parse subprocesses.
[#2658](#2658)
- "X has uncommitted changes" errors now list the dirty files inline.
[#2653](#2653)
**Fixed**
- `wt switch` integrates with `cd` aliases like zoxide (uses `builtin
cd`). [#2644](#2644), thanks
@xkumiyu for reporting
- Empty hook tables no longer panic during `wt switch --create`.
[#2635](#2635), thanks @topit
for reporting
- `Repository::current_worktree()` and five sibling helpers no longer
silently leak the process CWD when called via `Repository::at(p)`.
[#2652](#2652)
- `WorkingTree::is_linked` tolerates non-git CWDs (e.g. Nix sandbox).
[#2625](#2625), thanks
@DArtagan for reporting
- Picker no longer overlays `collect` warnings on the active TUI; clears
its frame on exit in inline mode.
[#2627](#2627),
[#2626](#2626)
- Failed `git log` no longer poisons the picker's preview disk cache.
[#2651](#2651)
- `wt step prune` says "removing branch" for branch-only candidates.
[#2619](#2619)
- Claude Code Windows integration uses a `wt.sh` wrapper to avoid
colliding with Windows Terminal's `wt.exe`.
[#1754](#1754), thanks
@lucaspimentel
**Documentation**
- cmux workspace integration recipe.
[#1907](#1907), thanks
@alvistar
See
[CHANGELOG.md](https://github.com/max-sixty/worktrunk/blob/release/CHANGELOG.md)
for the full list including internal CI / test-isolation changes.
## Test plan
- [x] `cargo run -- hook pre-merge --yes` (tests + lints clean)
- [x] `cargo semver-checks check-release -p worktrunk` (one breaking
change confirmed → minor bump)
- [x] CHANGELOG entries verified by subagent against actual diffs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Summary
The "X has uncommitted changes" error now lists the offending files via
git status --porcelainbetween the title and the hint, instead of leavingthe user to re-run
git statusto find out what's dirty.Before:
After:
What changed
GitError::UncommittedChangescarries a newdirty_files: Vec<String>field (raw porcelain lines).WorkingTree::ensure_cleanruns through a newdirty_files()helper that returns the porcelain lines instead of discarding them; the four call sites (wt mergecleanup,wt remove,wt step promote× 2) now thread the file list into the error.wt merge --no-commitvalidator incommands/merge.rs:155does the same.is_dirty()was already runninggit status --porcelainand dropping the output. We just stop dropping it on the failure path.Why
A user hitting "feature has uncommitted changes" today has to re-run
git statusto see what's blocking. The list is information we already have.There's a side benefit: this surfaces dirty state in test snapshots when something unexpected dirties a worktree mid-merge — useful for diagnosing the local-only flake on
test_readme_example_complexetc., where the failing snapshot will now carry the exact file list (likely an OS metadata file like.DS_Storeor an fsmonitor artifact) rather than a worktrunk bug.Test plan
cargo test --lib(1098 passed)cargo test --test integration(1633 passed; 1 new test case)cargo run -- hook pre-merge --yes— full lint + test suite (3531 passed, lints clean)🤖 Generated with Claude Code