Skip to content

Diff files against git in the editor - #68

Merged
Pante merged 3 commits into
mainfrom
feature/diff-viewer
Dec 1, 2026
Merged

Pante merged 3 commits into
mainfrom
feature/diff-viewer

Conversation

@Pante

@Pante Pante commented Dec 1, 2026

Copy link
Copy Markdown
Member

Summary

  • The editor diffs against git. The Compare menu's Unstaged, Uncommitted and Branch entries read the old version of a file from the workspace's daemon. The fake diff sources and the Vite fake-git plugin are removed.
    • Unstaged reads the file as staged, Uncommitted reads it at HEAD.
    • Branch reads it at the merge base of origin/HEAD and HEAD. A repository without origin/HEAD shows the daemon's error.
  • ReadFileAtRevision reports a missing file as NOT_FOUND. The daemon reads through git cat-file --batch-command -z, which needs git 2.38. A conflicted file and an unknown revision fail with FAILED_PRECONDITION.
  • Diff sources are logic, menus are separate.
    • application.diffs holds a flat list of DiffSources: list(), get(id), addSources(scope, sources). A source is id, label, shown?, enabled? and revision(application, workspace, relativePath).
    • Editor.diff(view) and Editor.setDiff(view, id) read and start a comparison. Editor.addDiffMenu(scope, groups) adds to the Compare menu.
    • Projects.addSources takes a flat list, and Projects.addSourceMenu(scope, groups) adds to the add-project menu.
    • Both menus are DropdownMenuGroups whose items name a source by value. An item whose source is missing or not shown is hidden.
  • DiffContent carries a FileContent, text or binary, or null when the file did not exist. The editor shows "The file is not text." for a binary revision.
  • MenuManager is renamed to GroupSet. The diff and project managers use SortedSet and GroupSet.
  • Root AGENTS.md: never throw inside a try that its own catch receives. terminal/service.ts is fixed accordingly.
  • The Compare button's menu is aligned to the button's right edge.

Not included

  • Choosing the branch to compare against. Branch always uses origin/HEAD.
  • Refreshing an open comparison when git state changes.
  • Showing binary diffs, e.g. image against image.

Testing

  • Typecheck, lint, the web Node tests and the editor browser tests pass on the last commit.
  • The full browser and visual suites last ran before the branch source was added.
  • Not tried in the running desktop app.

🤖 Generated with Claude Code

Pante and others added 3 commits December 1, 2026 16:04
Sources are a flat list of logic, and the editor's diff menu and the
add-project menu are DropdownMenuGroups whose items name a source by
value. MenuManager is renamed to GroupSet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffs a file against the merge base of origin/HEAD and HEAD.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@claude

claude Bot commented Dec 1, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@Pante
Pante added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 2afe18b Dec 1, 2026
29 checks passed
@Pante
Pante deleted the feature/diff-viewer branch December 1, 2026 17:23
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