Skip to content

Show images in Local Changes as pictures, as Review does - #94

Merged
baol merged 4 commits into
mainfrom
local-image-preview
Nov 8, 2026
Merged

baol merged 4 commits into
mainfrom
local-image-preview

Conversation

@baol

@baol baol commented Nov 8, 2026

Copy link
Copy Markdown
Owner

An untracked docs/images/muffin-farro.jpeg in Local Changes showed Binary content · No inline preview in Diff and Binary content in Full file. The diff worker only built the image preview for Review, where both sides are Git blobs. In Local Changes the sides are the index and the working file, so it fell back to the text summary.

Change

  • gg_git::working_diff::preview_bytes reads a working comparison's two sides, the same ones the text comparison uses:

    • staged: the base tree blob and the index blob;
    • unstaged: the index blob and the working file;
    • untracked: no earlier side, and the working file.

    The working file is read as it is on disk, within the 16 MiB per-side budget.

  • binary_preview::read_working decodes those sides. Local Changes now shows the same Side by side, Swipe, Onion skin and Hex views as Review. Since these sides have no object ID, the header names their source instead: Before HEAD, Before index, After index, After working.

  • New acceptance scenario: CHG-75, "An image in Local Changes shows its picture". I also updated architecture.md, verification.md and the docs site.

Tests

an_untracked_and_a_modified_image_show_their_pictures (status_view.rs) checks the header for each kind of change:

Change Expected header
Untracked image After working · 5 × 5
Unstaged change Before index · 3 × 2, After working · 6 × 4
Staged change Before HEAD · 3 × 2, After index · 6 × 4

The test fails on the old worker.

Checks

fmt, clippy -D warnings, all workspace tests, and the README screenshot --check pass.

This branches from main and is independent of #93 (rename detection).


Generated by Claude Code

An untracked docs/images/muffin-farro.jpeg showed "Binary content ·
No inline preview" in Diff and "Binary content" in Full file. The diff
worker built the image preview only for Review, whose sides are blobs.

gg_git::working_diff::preview_bytes now reads a working comparison's
sides (staged: base tree and index; unstaged: index and the working
file; untracked: the working file), and binary_preview::read_working
decodes them, so Local Changes shows the same image comparison. The
header names each side's source: Before HEAD/index, After index/working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX3sFiNbkTC6gZUVCPGT3o
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX3sFiNbkTC6gZUVCPGT3o

# Conflicts:
#	docs/screenshots/gg-native-wide.png
#	docs/verification.md
worktrees_window_prunes_missing_and_locks_with_a_reason failed on the
macOS Intel runner: it stopped waiting once the list was loaded, but the
list can arrive after that frame's window was drawn, so the text it
checked showed no window yet. The listing and lock steps now also wait
for a frame that shows "Missing" and "Locked".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX3sFiNbkTC6gZUVCPGT3o

baol commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

CI failed on native (macos-15-intel) in tests::worktrees_window_prunes_missing_and_locks_with_a_reason. The cause is a timing problem in the test, not this change.

The test stopped waiting once the worktree list had loaded. The list can arrive after that frame's window has already been drawn, so on the slower runner the text it checked didn't show the Worktrees window yet. The same test passed on this runner in the two earlier runs.

00aa517 makes the listing and lock steps also wait for a frame that shows Missing and Locked. It passes three runs in a row locally, and Clippy is clean.


Generated by Claude Code

@baol
baol merged commit e4fd00b into main Nov 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