feat(desktop): view full commit message from the Diffs tab commit list
What
Adds a way to read a commit's full message (subject + body) from the Diffs tab commit list, without leaving the app.
Why it wasn't possible before
This is a data-layer gap, not just a UI one. The commit list is built by getBranchComparison in apps/desktop/src/lib/trpc/routers/changes/workers/git-task-handlers.ts:193, which runs:
git log origin/<base>..HEAD --max-count=500 --format=%H|%h|%s|%an|%aI
%s is the subject only — the body is never fetched, so CommitInfo.message can only ever hold the first line. That's why the existing tooltip on CommitItem "reveals the same truncated subject line": there is nothing more in the payload to reveal.
I added a test that pins this down against a real temp repo (commit-message.test.ts, first case): a commit whose message has a body comes back from executeGitTask("getStatus", …) with message === subject and no trace of the body.
The change
Backend — fetch the message on demand
utils/commit-message.ts:readCommitMessage(git, hash)runsgit log -1 --format=%B <hash> --andsplitCommitMessage()splits it into{ subject, body }, folding a wrapped subject onto one line the way git's own%sdoes so the popover header matches the list row.isValidCommitHash()restricts the ref to a hex object name, so the input can't reachgit logas a flag or revision expression. Enforced insidereadCommitMessage, not just at the call site.commits.ts: newchanges.getCommitMessageprocedure, guarded byassertRegisteredWorktree.
On-demand rather than widening the status payload on purpose: getStatus is polled frequently and carries up to MAX_COMMIT_LIST_COUNT (500) commits, so shipping every body with each refresh would be a real cost for a rarely-read field.
Renderer — popover on the commit row
- New
CommitMessagePopover: a hover-revealed icon button on each commit row that opens a popover with the subject and the full body. The query isenabledonly while open and uses an infinitestaleTime(commit messages are immutable). Body text iswhitespace-pre-wrapandselect-text, so it can be read and copied — the renderer setsuser-select: noneglobally. CollapsibleRowgains an optionaltrailingslot. The row header lives inside Radix'sCollapsibleTrigger(a<button>), so the popover trigger had to be a sibling rather than nested — that also keeps click-to-expand-files on the row working unchanged.CommitItemis the only consumer ofCollapsibleRow.
Tests
apps/desktop/src/lib/trpc/routers/changes/utils/commit-message.test.ts — 11 tests:
- reproduction: the commit list payload carries only the subject
readCommitMessagerecovers subject + body for that same commit, from both the full and short hash- rejects non-hex refs (
--output=…,HEAD; rm -rf /) splitCommitMessage: subject-only, blank lines and indentation preserved in the body, wrapped subject folding, CRLF, empty inputisValidCommitHash: accepts short/full/uppercase hex, rejects flags,HEAD~1, branch names, too-short input
bun test apps/desktop/src/lib/trpc/routers/changes/ → 77 pass, 0 fail
bun run lint clean; bun run typecheck clean in apps/desktop.
Not verified / out of scope
- No CDP run. This environment has no running desktop instance, so the popover has not been exercised end-to-end in the real app. The backend behavior is covered by the tests above; the rendering is not. Worth a manual pass before merge.
- The
RightSidebarrenderer test suite has one pre-existing failure (useOrderedSections.test.tsx, missingelectronTRPCglobal) that reproduces on a clean tree — unrelated to this change, and the reason no component-level test was added here. - The v2 workspace sidebar has a separate commit list (
CommitFilterDropdown→CommitRow) with the same subject-only truncation, fed by host-service'sgit.listCommits. Left alone: the issue describes the v1 Diffs tab specifically (the tooltip behavior only exists there). The samegetCommitMessageshape would port over.
Closes #6043
Summary by cubic
View the full commit message (subject + body) from the Diffs tab via a popover on each commit row, without leaving the app. Addresses #6043 and avoids enlarging the polled status payload by fetching bodies on demand.
- New Features
- Backend: added
changes.getCommitMessageto readgit log -1 --format=%Band return{ subject, body }, with strict commit-hash validation. - UI: new popover button on each commit row shows the full message; loads only while open and caches forever; body is selectable and preserves formatting.
- Collapsible rows now support a
trailingslot so the popover trigger sits beside (not inside) the row’s button. - Tests cover message splitting, hash validation, short/full hashes, and the subject-only behavior in the existing commit list.
- Backend: added