Skip to main content

Module log

Module log 

Source
Expand description

mkit log [<rev>] [<A>..<B> | <A>...<B>] — walk commit history.

With no argument the walk starts at HEAD. A single <rev> starts there instead; a range A..B shows commits reachable from B but not A (empty side = HEAD, so A.. is A..HEAD and ..B is HEAD..B). An A...B symmetric range shows commits reachable from A or B but not their common ancestors (the merge base). Commits are ordered reverse-chronologically with a topological tie-break (a parent never precedes a child) — git’s --date-order. This is identical to git’s default for linear history and monotonic-timestamp merges; it can differ only on merge DAGs with non-monotonic (skewed or imported) timestamps.

Output modes:

  • default — human-oriented multi-line per commit on stdout. The full commit message body is printed indented (four spaces) and the timestamp is rendered as a stable UTC date (YYYY-MM-DD HH:MM:SS +0000), not the raw integer.
  • --oneline<abbrev-hex> <title> per commit on stdout. The abbreviation length defaults to 7 (DEFAULT_ABBREV) and is overridable with --abbrev[=N].
  • --format=json — JSONL, one self-contained JSON object per commit. Suitable for piping into jq.

--graph is accepted for git compatibility but is a no-op: it is a documented v1 non-goal (see docs/CLI.md). Full graph parity is not achievable given mkit’s content-addressed model; a limited --oneline --graph renderer remains a possible post-v1 follow-up.

History filters — --author/--grep (substring matches), --since/--until (a small explicit date grammar, see the dateparse submodule), and --no-merges/--first-parent — are applied to the walk before -n’s limit, so the limit caps the filtered result like git’s does. --first-parent prunes the walk itself (a merged side branch never enters the candidate set); --no-merges only hides merge commits from the already-walked output.

Argument parsing is delegated to clap-derive via crate::clap_shim::parse; clap emits standard diagnostics on errors and the shim maps them to mkit sysexits (USAGE for unknown flags, DATAERR for malformed -n values, etc.).

Functions§

run