Skip to main content

diff_index

Function diff_index 

Source
pub fn diff_index(
    cwd: &Path,
    refname: &str,
    cached: bool,
) -> Result<Vec<DiffEntry>, Error>
Expand description

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

cached = true reports staged changes (HEAD vs index); cached = false reports working-tree changes (HEAD vs working tree, including unstaged).

-M (rename detection) matches upstream’s git lfs status behavior; without it, a git mv shows up as a delete + add pair instead of an R entry, which the JSON-shape tests rely on.