Repository navigation
feat(desktop): view full commit message from the Diffs tab commit list - #6044
github-actions[bot] wants to merge 1 commit into
Conversation
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you:
Chapters generated by Stage for commit 6b69595 on Jul 29, 2026 8:14am UTC. |
|
Closing: wrong surface, and it would now fail CI. The change targets the v1 It also predates #6093, which added the #6043 stays open (tracked as SUPER-1688, Low), re-scoped to the v2 changes tab with the git read going through the worker. |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
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
getBranchComparisoninapps/desktop/src/lib/trpc/routers/changes/workers/git-task-handlers.ts:193, which runs:%sis the subject only — the body is never fetched, soCommitInfo.messagecan only ever hold the first line. That's why the existing tooltip onCommitItem"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 fromexecuteGitTask("getStatus", …)withmessage === subjectand 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:
getStatusis polled frequently and carries up toMAX_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
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:readCommitMessagerecovers subject + body for that same commit, from both the full and short hash--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 inputbun run lintclean;bun run typecheckclean inapps/desktop.Not verified / out of scope
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.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.
changes.getCommitMessageto readgit log -1 --format=%Band return{ subject, body }, with strict commit-hash validation.trailingslot so the popover trigger sits beside (not inside) the row’s button.Written for commit 6b69595. Summary will update on new commits.