A single record from git's raw diff format, as produced by
git diff-tree, git diff-index, and git diff-files with --raw -z.
Each record describes one changed path:
:<old_mode> <new_mode> <old_sha> <new_sha> <status>\0<path>\0status is a single letter for the common cases:
"A"- added"D"- deleted"M"- modified"T"- type changed (e.g. file to symlink)
For renames (R) and copies (C) git appends a similarity score to the
status letter (e.g. "R100") and emits a SECOND NUL-terminated path. In that
case status holds the raw token including the score, and path holds the
destination (new) path. The source path is not retained in this struct.
old_sha / new_sha are all-zero when the corresponding side does not exist
(for example old_sha is zeroed for an added file).
Summary
Functions
Parses NUL-delimited raw diff output into a list of Git.DiffRawEntry structs.
Types
Functions
Parses NUL-delimited raw diff output into a list of Git.DiffRawEntry structs.
Any leading token that is not a metadata record is skipped. This handles the
bare commit-id header (a SHA followed by NUL) that single-argument
git diff-tree emits before its records.
Combined-diff records (merge output prefixed with ::) do not match the
expected five-field shape and are skipped rather than mis-parsed.
Returns [] for empty input.