Expand description
Embeddable diff facade and report model.
Structs§
- Context
Snippet - Diff
Options - Options for computing a diff report through the embeddable facade.
- Diff
Report - Diff
Stats - File
Change - File
Context Entry - File
EolState - Trailing-newline state for both sides of a file change, plus the
total line count per side. The patch renderer reads these to decide
whether to emit
\ No newline at end of fileand where. - Line
Counts - Line
Diff - Plain
GitDiff Probe - Core-friendly view of the plain-Git probe the CLI health layer discovers.
- Semantic
Change Entry - Symlink
Change - The raw symlink target bytes for each side of a symlink change. A
symlink’s git blob is exactly its target bytes (no trailing newline), so
these are the authoritative content the patch renderer emits.
oldisNoneon an add,newisNoneon a delete, and both areSomeon a target-edit or rename-with-edit. The bytes come from the same loaders the hunk path uses (symlink_target_bytesfor the worktree, the stored blob for a tree side), so a non-UTF-8 target survives without lossy conversion.
Functions§
- change_
line_ counts - compute_
state_ diff - Compute a state-to-state diff payload without printing.
- compute_
tree_ diff - Compute a diff from an existing state to an in-memory tree.
- diff
- Compute a Heddle diff report without rendering to stdout.
- diff_
worktree_ status - Compute a HEAD-vs-worktree report from an existing status scan.
- plain_
git_ head_ diff - Compute a HEAD-vs-worktree report for a plain Git repository discovered by the CLI health layer.
- render_
diff_ patch - Lossy String view of the byte-exact patch (
render_diff_patch_bytes), for the JSON.patchfield and String-based callers/tests. Only a non-UTF-8 symlink target (Unix-only) differs from the byte render; JSON strings cannot carry raw bytes, so a lossy view is the best a String surface can do. The round-trip surface (heddle diff --patch) writes the bytes directly viarender_diff_patch_bytes, so its byte fidelity is never reduced here. - render_
diff_ patch_ bytes - should_
render_ modified_ pair - trim_
added_ decorations_ for_ display - Pretty-display transform: drop a leading added “decoration” line
(
#[...],///,@, etc.) when an identical context line already follows the inserted block, so the diff anchors on the existing item rather than showing a duplicated attribute. - write_
diff_ patch