Skip to main content

Module diff

Module diff 

Source
Expand description

mkit diff — show changes as a unified patch.

Modes:

  • no args — HEAD tree vs a fresh worktree snapshot;
  • --staged / --cached — HEAD tree vs the staged index tree (what mkit commit would record);
  • one revision (<rev>) — that revision’s tree vs the worktree (or vs the staged index with --staged);
  • two revisions (<a> <b>) or a range (<a>..<b>) — diff the two resolved trees against each other.

A leading positional that is not a resolvable revision is treated as the start of the pathspec list; a leading positional that looks like a revision (ref / commit / range) but fails to resolve is a hard error rather than a silent empty diff (#207).

Trailing positional paths (pathspecs) filter the output to entries at or below those paths. The default output is a Git-compatible unified diff: a git-shaped diff --git a/<p> b/<p> header per changed path (with new file mode/deleted file mode/index/--- a/p/+++ b/p lines, /dev/null for adds/deletes) followed by Myers-diff hunks (or a Binary files … differ line). The index ids are abbreviated BLAKE3 prefixes — the one inherent divergence from git diff.

--name-only / --name-status switch to summary output: one record per changed path — just the path, or an A/D/M status letter (T for an mkit mode change) plus the path. Special-byte paths are C-style quoted (git core.quotePath); -z instead NUL-terminates records and emits raw paths (and, for --name-status, NUL-terminates the status letter and path as separate fields).

Functions§

run