Skip to main content

Module blame

Module blame 

Source
Expand description

mkit blame [-w] [-M] [-C] [--ignore-rev <rev>] [--ignore-revs-file <file>] [--ignore-rev-precise] [--first-parent] [--reverse] [<rev>] [-L <range>] <file> — line-level attribution.

Blames <file> as of <rev> (default HEAD), optionally restricted to a line range with -L. -w ignores whitespace when matching lines across revisions (git -w); -M/-C detect lines moved within the file / copied from other files (git -M/-C); --ignore-rev / --ignore-revs-file skip “noise” commits during attribution (git --ignore-rev), falling through to the commit that previously changed each line. --ignore-rev-precise (mkit-only; requires --ignore-rev/ --ignore-revs-file) refines that fall-through with content matching instead of git’s positional per-hunk guess — a documented divergence, opt-in only. Blame is merge-aware by default (a line merged from a side branch is credited to the commit that wrote it); --first-parent restricts the walk to first parents (git --first-parent). --reverse <start>..<end> instead walks history forward, attributing each line of the <start> version to the last commit in the range in which it still existed (git --reverse).

Output modes:

  • default — <short12>\t<line_num>\t<text>\n per line, pinned by the integration test in tests/cli_wire.rs:233-243.
  • --format=json — JSONL, one self-contained record per line with keys hash, line_num, author, timestamp, text. Schema diverges from the tab format because mkit’s author is an Identity, not a Name <email> string — see commands/log.rs for the same divergence.

Line numbers in the output are always the file’s own 1-based numbers, so a -L 40,60 slice still prints 40..=60, matching git blame -L.

Functions§

run