Plumbing for tools that already know which blobs to diff.
Plumbing that diffs explicit blob pairs you hand it on stdin. Skips the tree walk entirely so callers that already know which blobs to compare don't pay for one.
Think of it as the tail end of the diff pipeline: you've done the discovery, this command does the rendering. Input is one record per pair, NUL-terminated, in the same shape diff-tree would emit with -z --raw.
git diff-pairs [<diff-options>] -z <path>
git diff-pairs [<diff-options>] -z < <input>
Each input record:
:<mode1> SP <mode2> SP <oid1> SP <oid2> SP <status> NUL <path1> NUL [<path2> NUL]| Flag | What it does |
|---|---|
-z | Required. NUL-terminated input and output; pathnames are not quoted. |
<input> | File to read records from; default is stdin. |
-p / --patch | Emit a unified patch for each pair (default behavior for a diff command). |
--raw | Emit the raw diff format instead of patches. |
--name-only | List only paths touched by the supplied pairs. |
--stat | Show a diffstat summarizing the supplied pairs. |
diff-tree -z --raw would have produced, without re-running the tree walk.git diff-tree -r -z --raw HEAD^ HEAD | git diff-pairs -z -pprintf ':100644 100644 %s %s M\0README.md\0' $oid1 $oid2 | git diff-pairs -z -pgit diff-pairs -z --stat <pairs.bingit diff-pairs -z --name-only <pairs.bin-z; it's the only safe input mode and any path with whitespace will bite you otherwise.git diff-tree -z --raw first to learn the exact byte layout before hand-rolling it.<path1> (or <path2> for renames/copies) silently truncates the next record.Hit each option, then Check answers. Score is recorded; Next is always open.