Mutare.Changes (mutare v0.1.2)

Copy Markdown View Source

Source lines changed versus a git ref — the basis for mix mutare --since, the CI mode that mutation-tests only what a branch touched.

Scoping is per-line, not per-file: a one-line edit to a large module mutates only that line, not the whole file. The changed lines are fed to :only_lines (the same site filter --line uses), so a --since run and a --line run share all the downstream machinery.

Summary

Functions

Lines changed under root versus ref, as a set of {relative_path, line} pairs on the new side of the diff (the lines that now exist to be mutated).

Functions

since(root, ref)

@spec since(Path.t(), String.t()) :: {:ok, MapSet.t()} | {:error, String.t()}

Lines changed under root versus ref, as a set of {relative_path, line} pairs on the new side of the diff (the lines that now exist to be mutated).

Uses git diff -U0 --relative, run with root as the working dir, so it reports working-tree changes (committed and uncommitted) since ref, scoped to and relative to root. The diff command disables presentation/user hooks and pins prefixes because the output is parsed, and turns off core.quotePath so a non-ASCII pathname arrives verbatim rather than octal-escaped. -U0 drops context lines so only genuinely-added lines land in the set; pure deletions contribute nothing (their file drops out entirely if it has no other changes). Returns {:error, detail} if git fails (no repo, bad ref, git missing).