Skip to content

fix(commit): collapse and cap the auto-staging untracked listing - #4152

Merged
max-sixty merged 3 commits into
mainfrom
cap-auto-staging-file-list
Sep 16, 2026
Merged

max-sixty merged 3 commits into
mainfrom
cap-auto-staging-file-list

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

#4111 switched the status read behind the auto-staging warning to -uall, so the warning sees untracked files that status.showUntrackedFiles=no hides. That flag also expands every untracked directory into its files, so wt step commit, wt step squash, and wt merge listed 300 paths for a directory of 300 new files before committing.

The warning now reads git's normal untracked mode instead. It still overrides status.showUntrackedFiles=no, but names a wholly untracked directory once as dir/, so a directory of generated files takes one row and can't push a separate new file out of view. The file count stays visible in the commit progress line that follows.

The listing also stops at ten rows. Past ten paths it lists nine and a hint counts the rest, so the hint always stands for at least two paths:

▲ Auto-staging 11 untracked paths:
   ┃ 0-generated/
   ┃ 01.txt
   ┃ …
   ┃ 08.txt
↳ … and 2 other paths
◎ Generating commit message and committing changes... (310 files)

The status read also moves into the warning itself. Commit and squash each built that command before calling the warning, one through WorkingTree and one through Repository; both now go through the WorkingTree they stage.

Thanks to @Duang777, whose #4112 proposed the cap. They're credited as co-author.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

max-sixty and others added 2 commits September 16, 2026 15:05
Since `-uall` expanded untracked directories (#4111), auto-staging a
directory of 300 new files printed all 300 paths before the commit ran.
The warning still counts every path, but the listing now stops at ten
rows: past ten paths it lists nine and a hint counts the rest
(`… and 291 other paths`), so the hint never replaces a path it could
have shown.

The cap comes from @Duang777's #4112.

Co-authored-by: DDL <duanjialing.777@bytedance.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`wt step commit` and `wt step squash` each ran the same
`git status --porcelain -z -uall` before calling the warning, one
through `WorkingTree` and one through `Repository`; #4111 had to change
both. The warning now takes the `WorkingTree` it describes and reads the
status itself, so the `-uall` rationale lives once and both callers run
it with the worktree-scoped environment their `git add -A` uses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@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.

The cap itself is right, and the nine-plus-hint arithmetic checks out (over the cap the hint always stands for at least two paths, so the plural is never wrong). One consequence of where the cut lands is worth a decision.

git status -uall emits paths in sorted order, so a single untracked directory with ten or more files fills every row on its own and the rest of the worktree is never named:

$ git status --porcelain -uall
?? apples/1.txt
?? apples/10.txt
... (apples/11, 12, 2..9)
?? secrets/key.pem

That renders as nine apples/* rows and … and 4 other paths. secrets/key.pem is about to be staged by git add -A and the user is not told. Before #4111 the same worktree listed two rows — apples/ and secrets/ — because git's default untracked mode collapses directories; #4111 switched the read to -uall for the count, and the cap now spends the whole listing on whichever directory sorts first. The count line covers the "300 paths, something is wrong" case on its own, but in the moderate case (say 15 paths across three directories) it is the which areas detail that makes the warning actionable, and that is the part the cap drops.

A shape that keeps both: count with -uall as now, and build the capped listing from the collapsed entries, so every untracked directory gets a row and the cap only bites past nine distinct areas.

Raising this for a decision rather than blocking — it is a judgment call about what the warning is for, and capping is an improvement over printing 300 rows either way.

`-uall` expands every untracked directory into its files, and git sorts
them, so a directory of generated files filled all nine rows of the
capped listing and pushed a separate new file, the one the warning
exists to surface, into the "other paths" count. The warning now reads
git's `normal` untracked mode, which still overrides
`status.showUntrackedFiles=no` but names a wholly untracked directory
once as `dir/`. The per-file magnitude stays visible in the commit
progress line that follows (`(310 files)`).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@max-sixty max-sixty changed the title fix(commit): cap the auto-staging untracked-path listing fix(commit): collapse and cap the auto-staging untracked listing Sep 16, 2026
@max-sixty
max-sixty merged commit f405790 into main Sep 16, 2026
38 checks passed
@max-sixty
max-sixty deleted the cap-auto-staging-file-list branch September 16, 2026 23:37
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.

2 participants