Expand description
Structured line diffs for CLI and embedders (grit diff, grit show).
Preserves line-ending details (CRLF vs LF, missing newline at EOF), mode-only changes, hunk line counts, and optional UTF-8 lossy decoding markers — without relying on unified patch text parsing.
Structs§
- Side
Bytes - Bytes of one file side prepared for diffing.
- Structured
File Diff - File metadata plus a structured line diff.
- Structured
Hunk - A contiguous run of changes plus surrounding context.
- Structured
Line - One rendered line in a structured hunk.
- Structured
Segment - One run of text within a line, with optional intra-line emphasis.
- Structured
Text Diff - Line-level diff of two text sides (no file metadata).
Enums§
- Structured
Line Kind - Kind of line in a structured hunk.
Functions§
- format_
hunk_ range - Format one unified hunk range side (
1,1,2, or0,0). - structured_
file_ diff - Build a structured file diff including mode metadata from a tree diff entry.
- structured_
text_ diff - Build a structured line diff from two decoded text sides.