Skip to main content

Module diff_index

Module diff_index 

Source
Expand description

git diff-index -z parser.

Used by git lfs status to enumerate staged + unstaged changes against HEAD. The -z form is mandatory for correctness: paths can contain spaces, newlines, and quoting metacharacters; without -z, git would render those quoted and we’d have to undo the encoding.

Output format (one record per change):

:<src-mode> <dst-mode> <src-sha> <dst-sha> <status>\0<src>\0[<dst>\0]

<status> is a single letter A/M/D/R/C/T/U/X, optionally followed by a 1–3 digit similarity score for R and C. The trailing <dst> field is only present for renames and copies.

Structs§

DiffEntry

Functions§

diff_index
Run git diff-index -z [--cached] <ref> and return the parsed entries.