Selected unified-diff and history-file backends
Source pin: 7338078f8ddd924b8cddee35f512f2286072136d.
This connected family covers the Diff command (index 4) and LogListDiff (index
15) consumers of Git.cpp, GitRevLoglist.cpp and their native preview/list
surfaces. It is a partial workflow audit, not completion of Log, Commit or Merge.
Source behavior and boundaries
UsingLibGit2 requires the master UseLibgit2 switch and the corresponding
UseLibgit2_mask bit. Native dialogs retain the existing Advanced settings;
there is no additional backend switch in their UI.
The selected GetUnifiedDiff branch resolves its two endpoints and produces
libgit2 full statistics, a separating newline, then patch bytes. Its defaults do
not carry the CLI branch's context, combined-merge or rename-detection switches.
A working-tree endpoint means tracked working-tree content; index changes and
working bytes participate in the source tree-to-working-directory comparison.
An empty endpoint uses the source previous-parent rules; a root has an empty-tree
base. Unsupported or malformed scope fails before helper launch. Literal native
file paths remain literal, rather than gaining wildcard/pathspec authority.
GitRevLoglist::GetFiles uses the selected history engine for historical
changed-file rows, including root commits and separate merge-parent groups.
Full reads retain actions, old/new paths and line counts; binary counts remain
absent. Rename/copy finding follows the captured detection threshold. Simple
path reads used by filtering and Find use their separate source path-only diff
and stable ordering. Working-tree pseudo-revisions continue through their
existing status readers. The pinned helper uses SHA-1 object IDs; a SHA-256
repository is not claimed supported by the selected-library branches. An ordinary raw stat/status read is not made a
LogListDiff request merely because it yields file counts.
Unified display is distinct from an editable staging patch. Index-only
--cached comparisons and PatchWindow partial-staging documents keep their
existing CLI reader, binary/metadata support and exact index semantics. Generic
GitRepository.run is unchanged. Separate no-index file comparisons, Merge's
Subversion engine, raw historical baselines and Blame's porcelain engine retain
their independent readers.
Native consumers
An accepted native read snapshots its owning preferences into a repository reader, retaining the original Git executable, askpass, rename policy and any injected helper URL. Log selection details, per-parent groups, lazy action icons, history filtering, Find and patch previews therefore use one captured policy through their asynchronous request. Persistent file-cache contexts include the effective engine/helper identity; native lazy-action caches and Find's reused selected-file records also reject mismatched backend identities.
Log single/two-revision and selected-file Unified Diff, working-tree Unified Diff, Commit's display-only diff, Status, Changed Files, RefLog, reference-browser and revision-graph unified requests use the same boundary. Blame's parent-history Unified Diff uses that reader without replacing Blame's own engine. Explicit primary-command Unified Diff routes capture their accepted request preferences. Source icons, parent menus, diff options, selected paths, cancellation tokens and existing pane/result ownership remain the interface.
Generated bytes retain their captured backend through external viewer launch, built-in patch review and Save/export. New built-in viewers receive the owning preference domain. A subsequent explicit Refresh captures current preferences for its new read. Stale selection, replaced document, cancelled request, retired window and attached-sheet checks continue to prevent late publication; a new engine choice does not bypass an existing owner or Save transaction.
Validation and limits
docs/qa/diff-backend-native-2026-10-20.swift and
scripts/test-diff-backend.py provide the grouped native checkpoint with actual
Log/Find/patch and Status/Changed Files readers. They wrap the selected real
helper to record routing, use private repositories/preferences/cache directories,
and hold a unified read to exercise cancellation and retirement. Optional
--helper selects the packaged helper. Windows are hidden/offscreen and owned
helpers are cancelled and reaped by the receiver owner.
The dated checkpoint records 20 relevant Core methods passing, the universal helper and final Debug app passing, and three native cases on system and bundled Git passing. Every owned receiver was reaped and independently absent. The helper's initial unsupported diagnostic class was repaired before the grouped Core/native checks. Separate word-input CRLF failures in the combined Core run are retained in the evidence; passing diff/history checks were not repeated. Full hosted CI, physical menu and accessibility interaction, every merge-parent/rename combination, minimum-OS and signed/sandbox/Finder deployment remain separate acceptance work. This family does not claim that selected libgit2 and CLI patches are byte-identical: their source-defined defaults differ.