Skip to content

feat: list the commits a pull request would land#98

Merged
omartelo merged 4 commits into
mainfrom
feat/pr-commits-tab
Jul 25, 2026
Merged

feat: list the commits a pull request would land#98
omartelo merged 4 commits into
mainfrom
feat/pr-commits-tab

Conversation

@omartelo

Copy link
Copy Markdown
Owner

What

A Commits tab on the Pulls screen: every commit the pull request would land, counted next to the tab name, oldest first as gh lists them — subject, author and date, with the message body under it the way git prints one.

Why

The screen showed what a pull request changes — description, files, checks — but never what it is made of. Reading how the branch got there meant leaving for the browser, and the diff alone never tells that story: one 40-file diff can be one commit or fifteen.

How

commits joins the gh pr view --json selection the screen already requests, so the tab costs no extra round-trip. toCommits flattens gh's entries into PRCommit{oid, headline, body, author, date} — the first author names the row (the list exists for co-authored commits), gh's order is kept, and no commits yields nil so the tab can tell "none" from a list.

  • internal/project/pr.goPRCommit, toCommits, the field in prViewFields and PRDetail
  • frontend/src/lib/api-types.ts — the hand-owned mirror
  • frontend/src/components/pulls/PullsCommits.tsx — the tab
  • frontend/src/components/pulls/Pulls.tsx — tab button with the count, panel wiring

Test plan

  • go test ./... — 404 pass, including TestToCommits (body/author/order, bare commit, login→name fallback) and the commits assertion in TestParsePRDetail
  • gofmt -l . / go vet ./... clean
  • pnpm check, tsc --noEmit, vitest run (408), vite build
  • gh pr view --json <full field set> accepted by the real CLI
  • Smoke in task dev: the tab renders, the count matches, a one-line commit shows no body block — the frontend suite is node-only and does not render

Notes

Deliberately out: opening a commit on GitHub from a row, collapsing long bodies, grouping by author. None of it was asked for; the tab answers "how many, and which".

omartelo added 4 commits July 25, 2026 19:48
The Pulls screen showed what a pull request changes — the description, the
files, the checks — but never what it is made of. Reading how the branch got
there meant leaving for the browser, and the diff alone never tells that story:
one 40-file diff can be one commit or fifteen.

A "Commits" tab now lists them, counted next to its name, oldest first as gh
lists them: subject, author and date, with the message body under it the way
git prints one. The commits ride along with the gh pr view the screen already
makes, so the tab costs no extra round-trip.
The first tab printed every message in full, so a branch of fifteen commits
became a wall of prose you had to scroll past to count them. A row is now the
subject line, who committed it and when; the body sits behind the row's toggle,
the way GitHub's own list reads.
Reading a message meant hitting a small ellipsis button beside the subject —
GitHub's affordance, and a target you have to aim at for something the row
already stands for. The row itself is the button now: it fills on hover, a
chevron marks the commits that have a body, and one that doesn't stays inert
instead of offering a toggle with nothing behind it.
The app turns every enabled button into a pointer target, which reads as "this
goes somewhere". A commit row goes nowhere — it unfolds in place — so it keeps
the arrow, like the text it is.
@omartelo
omartelo merged commit e8b3a2d into main Jul 25, 2026
3 checks passed
@omartelo
omartelo deleted the feat/pr-commits-tab branch July 25, 2026 23:09
This was referenced Jul 25, 2026
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.

1 participant