Repository navigation
refactor(list): hoist short_sha onto ListItem so every row has it - #2577
Merged
Merged
Conversation
The pre-skeleton `commit_details_many` batch already returns `%h` for every row, but the abbreviated form was tucked inside `CommitDetails` — which is intentionally left empty for prunable worktrees and any row missing from the batch. The JSON path then had to fall back to slicing `sha[..7]` to keep `short_sha` populated, reintroducing the manual prefix trick this branch's parent PR removed everywhere else. Move `short_sha` onto `ListItem` directly. The populate loops now set it on every row before the prunable skip, and `JsonItem::from_list_item` reads `item.short_sha` without a fallback. `CommitDetails` shrinks to the per-commit data (timestamp + message) it actually gates. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
May 4, 2026
max-sixty
added a commit
that referenced
this pull request
May 4, 2026
The last manual `&self.head[..8]` slice in the list path. Routes through the canonical `short_sha` instead, completing the cutover started in #2576 (every short-SHA emission through git's `%h`/`rev-parse --short` machinery) and #2577 (hoisting `short_sha` onto `ListItem`). When `short_sha` is empty the function returns `""`. The unborn-branch case is caught by the branch arm. The only path where this falls through to an empty string is "detached HEAD where the `commit_details_many` batch failed" — already a degraded state with placeholders in every other cell, so an empty diagnostic label is acceptable. > _This was written by Claude Code on behalf of @max-sixty_ Co-authored-by: Claude <[email protected]>
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.
Follow-up to #2576. The parent PR routed every short-SHA display through
git's abbreviation logic, but the JSON path kept asha[..7]slice fallback for prunable worktrees and rows whose batch failed — those rows have noCommitDetailspopulated, so the field had nowhere to read from.The pre-skeleton
commit_details_manybatch already returns%hfor every row in the list, including prunable worktrees (the batch runs against the repo, not the worktree dir). Hoistingshort_shaout ofCommitDetailsand ontoListItemdirectly lets the populate loops set it on every row before the prunable skip;JsonItem::from_list_itemthen readsitem.short_shawithout a fallback.CommitDetailskeeps the prunable skip for the timestamp/message bundle, which is what actually preserves the old task-queue UX.Net effect: every short-SHA emission in worktrunk now routes through
git's%h/rev-parse --shortmachinery — no manual slicing left in the user-facing path.