Skip to content

feat(git): a commit opens as its own tab, with GitHub avatars in History - #389

Merged
pacifio merged 2 commits into
pacifio:0.4.1from
Ukaykhingmarma28:feat/commit-tab-history
Oct 8, 2026
Merged

pacifio merged 2 commits into
pacifio:0.4.1from
Ukaykhingmarma28:feat/commit-tab-history

Conversation

@Ukaykhingmarma28

@Ukaykhingmarma28 Ukaykhingmarma28 commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

The commit tab: author header, Commit SHA, files side by side; History with GitHub avatars

What?

  • History rows in Source Control read as the message, then avatar · author · time · short sha, with a "View commit diff" hint.
  • Clicking a commit (in History or the Git Graph) opens a commit tab in the centre, instead of swapping the sidebar for a detail view:
    • author header (avatar, name, date · email, message) and a Commit SHA copy button;
    • every changed file as a collapsible section — filename, then its folder muted, +N −M;
    • split / unified toggle (remembered), collapse / expand all, total +N −M;
    • cherry-pick, revert, reset, tag and the produced-by-session links moved here from the old detail view.
  • GitHub avatars for commit authors in History, the commit tab and the Git Graph.
  • "Git Diff" leaves the new-tab menu and palette. The commit tab replaces that standalone module; Git Diff tabs for a single file (Changes → open in diff view, the commit tab's per-file button, ui_open diff) are unchanged.

Why?

The old sidebar detail view squeezed a whole commit into the sidebar width, and avatars were Gravatar-only, so most authors showed a generic icon. Reading a commit wants the editor's width and the faces people know from GitHub. The blank Git Diff module was the other way to browse a commit; with the commit tab it is redundant.

How?

  • Commit tab (commit-view.tsx, new tab type commit, id commit:{repo}:{sha}): parses the git_show diff client-side; split rows are paired by the new splitHunkLines (a removal run sits across from the addition run that replaced it). Virtualized, with stable row ids so collapse and mode switches keep measured heights.
  • Merges: git_show, the per-file commit diff and the commit file list now use -m --first-parent, so a merge shows what it brought into its branch — before, a clean merge showed "No file changes". Ordinary commits are unaffected.
  • Binary files and renames say so ("Binary file — no text diff.", "renamed from …") instead of an empty +0 −0 section.
  • Avatars (git_avatars.rs, git-avatars-api.ts): one gh api repos/{owner}/{repo}/commits?sha={branch} call per repository through the user's own gh (reusing git_pr.rs's runner, timeout and permits), shared by every avatar via the query cache. A branch GitHub doesn't have falls back to the default branch; a timed-out call doesn't retry. Lookup order: GitHub → the account id in a …@users.noreply.github.com email → Gravatar → glyph. gh missing or signed out backs off for 10 minutes. CSP (prod and dev) admits https://avatars.githubusercontent.com only.
  • Retired Git Diff module: removed from NEW_TAB_OPTIONS and the new-tab palette; isRetiredTab drops a saved blank Git Diff tab on both restore paths, so old layouts don't bring back a tab nothing can open.

Known gaps: long lines clip (the per-file "Open in diff view" shows them whole); no expand-context arrows or search / GitHub buttons in the toolbar; GitHub avatars need gh installed and signed in, and cover authors in the branch's newest 100 commits (plus any noreply email).

Checklist

  • Targets the current version branch (0.4.1)
  • New behaviour has a test: splitHunkLines pairing, binary / rename parsing, the git_repo_avatars IPC seam and its back-off, isRetiredTab; Rust: avatar parsing, origin filter and wire shape (6 tests)
  • You've run the app and used the change in a window — not yet; the screenshot is from a dev build
  • Locally: typecheck, lint, format, contract tests 268/268; vitest 2,535 passed, 2 failed — target-gc.test.ts and message-body.test.tsx, which fail the same way on the base commit 987226c7 and pass when run on their own. Rust: git_avatars, gitdiff, git_pr, git_ops 38 passed.

Summary by CodeRabbit

  • New Features
    • Added detailed commit tabs with file-by-file diffs, commit metadata, related sessions, and available Git actions.
    • Commit history now displays author avatars and opens commits in dedicated tabs.
    • Added GitHub avatar lookup for repository contributors, with Gravatar and generic-icon fallbacks.
    • Merge commit diffs now compare changes against the first parent.
  • Bug Fixes
    • Improved split diffs to align additions and deletions and identify binary and renamed files.
    • Removed the Git Diff option from the new-tab menu.

Source Control → History rows now read as message, then avatar · author ·
time · short sha. Clicking one (or a node in the Git Graph) opens a "commit"
centre tab instead of swapping the sidebar for a detail view: the author
header with a Commit SHA copy, and every changed file as a collapsible
section, split or unified, with expand/collapse-all and +/- totals. The
cherry-pick, revert, reset, tag and produced-by-session controls moved with
it.

Avatars come from GitHub through the user's own `gh` (git_repo_avatars: one
`gh api` call for the branch's newest 100 commits, shared by every avatar in
the repository), then the noreply-email account id, then Gravatar, then a
glyph. The CSP admits avatars.githubusercontent.com.

`git show` for a commit, its per-file diff and its file list now use
`-m --first-parent`, so a merge shows what it brought into its branch rather
than an empty combined diff. Binary files and renames say so instead of
rendering as an empty +0 −0 section.

The standalone Git Diff module (a blank tab with a file tree and commit
picker) leaves the new-tab menu and palette — the commit tab replaces it.
Layouts saved with one drop it on restore; Git Diff tabs for a file stay.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7004553-dd44-4221-b192-9b0685936059
📥 Commits

Reviewing files that changed from the base of the PR and between c910430 and 7f8e8f7.

⛔ Files ignored due to path filters (1)
  • .github/pr-assets/commit-tab.png is excluded by !**/*.png
📒 Files selected for processing (32)
  • src-tauri/src/commands/git_avatars.rs
  • src-tauri/src/commands/git_ops.rs
  • src-tauri/src/commands/git_pr.rs
  • src-tauri/src/commands/gitdiff.rs
  • src-tauri/src/commands/mod.rs
  • src-tauri/src/lib.rs
  • src-tauri/tauri.conf.json
  • src/components/new-tab-palette.tsx
  • src/dev/mock-backend/fixtures/git.ts
  • src/dev/mock-backend/scenarios/git-conflict.ts
  • src/dev/mock-backend/scenarios/northwind-git.ts
  • src/dev/mock-backend/scenarios/northwind.test.ts
  • src/features/git/components/changed-files-tree.tsx
  • src/features/git/components/commit-avatar.tsx
  • src/features/git/components/commit-node.tsx
  • src/features/git/components/commit-view.tsx
  • src/features/git/components/git-diff-modal.tsx
  • src/features/git/components/git-diff-panel.tsx
  • src/features/git/components/git-graph-panel.tsx
  • src/features/git/components/git-manager/git-manager-panel.tsx
  • src/features/git/components/git-manager/history-view.tsx
  • src/features/git/lib/diff.test.ts
  • src/features/git/lib/diff.ts
  • src/features/git/lib/git-avatars-api.test.ts
  • src/features/git/lib/git-avatars-api.ts
  • src/features/git/lib/git-errors.ts
  • src/features/git/lib/open-commit.ts
  • src/features/git/stores/git-store.ts
  • src/features/layout/components/center-panel.tsx
  • src/features/layout/stores/layout-store.ts
  • src/features/layout/stores/retired-tabs.test.ts
  • src/lib/constants.ts
💤 Files with no reviewable changes (2)
  • src/features/git/components/git-manager/git-manager-panel.tsx
  • src/components/new-tab-palette.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The changes add repository-scoped GitHub avatar lookup, dedicated commit tabs with detailed commit views, and first-parent diffs for merge commits. They also update commit log data, layout restoration, and mock responses to support these changes.

Changes

Git commit experience

Layer / File(s) Summary
Repository avatar lookup
src-tauri/src/commands/git_avatars.rs, src-tauri/src/commands/git_pr.rs, src-tauri/src/commands/mod.rs, src-tauri/src/lib.rs, src-tauri/tauri.conf.json, src/features/git/lib/git-avatars-api.ts, src/features/git/lib/git-avatars-api.test.ts, src/features/git/components/commit-avatar.tsx, src/features/git/components/commit-node.tsx, src/dev/mock-backend/fixtures/git.ts
The native command fetches and validates repository avatar mappings. The frontend caches lookup results and uses GitHub avatars, no-reply addresses, and Gravatar as ordered sources.
Commit history and tab navigation
src/features/git/stores/git-store.ts, src/dev/mock-backend/fixtures/git.ts, src/dev/mock-backend/scenarios/*, src/features/git/components/git-manager/*, src/features/git/components/git-graph-panel.tsx, src/features/git/lib/open-commit.ts, src/features/layout/components/center-panel.tsx, src/features/layout/stores/*, src/lib/constants.ts, src/components/new-tab-palette.tsx, src/features/git/components/changed-files-tree.tsx, src/features/git/components/git-diff-*.tsx
Commit log entries now include author emails. Selecting a commit opens a commit tab. The history view no longer contains commit details, and layout restoration filters fileless diff tabs.
Commit details and diff rendering
src/features/git/components/commit-view.tsx, src/features/git/lib/diff.ts, src/features/git/lib/diff.test.ts, src/features/git/lib/git-errors.ts, src-tauri/src/commands/git_ops.rs, src-tauri/src/commands/gitdiff.rs, src/dev/mock-backend/fixtures/git.ts, src/dev/mock-backend/scenarios/*
Commit tabs display commit metadata, actions, linked sessions, and split or unified diffs. Diff parsing records binary and rename metadata and aligns changed lines. Merge commit diffs use the first parent.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant GitGraphPanel
  participant OpenCommit as openCommit
  participant LayoutStore as layout store
  participant CenterPanel
  participant CommitView
  GitGraphPanel->>OpenCommit: Open repository path, SHA, and subject
  OpenCommit->>LayoutStore: Create or focus and activate commit tab
  LayoutStore->>CenterPanel: Provide active commit tab
  CenterPanel->>CommitView: Render with repository path and SHA
  CommitView->>CommitView: Load commit details and render diff
Loading

Suggested reviewers: uzayer, pacifio

Merge Risk: ⚪ Minimal · up to 7f8e8

This change opens commits in their own tabs, adds GitHub avatars to History, and shows merge commits against their first parent. No concrete defect was identified. Author emails reach History rows from the native backend, so avatars can resolve. Saved single-file diff tabs and commit tabs are still restored.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 59.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 29 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two primary changes: opening commits in dedicated tabs and displaying GitHub avatars in History.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 59.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 29 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@pacifio
pacifio merged commit 6adf6a8 into pacifio:0.4.1 Oct 8, 2026
10 checks passed
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