diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-22 17:07:07 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-22 17:07:07 -0500 |
| commit | 759676fcd0a9833dffe4d42b90b36c228ec34861 (patch) | |
| tree | 93fe62d3696612a5690b508494274b0d524b172b /modules/archived | |
| parent | 1097878bcb45a1c68ec5f9e44a727c2dd7e45725 (diff) | |
| download | dotemacs-759676fcd0a9833dffe4d42b90b36c228ec34861.tar.gz dotemacs-759676fcd0a9833dffe4d42b90b36c228ec34861.zip | |
feat(coverage): add changed-lines helper and diff parser
Second of three pure helpers for the coverage-report command.
cj/--coverage-parse-diff-output is pure. It takes a git unified-diff string and returns a hash table of file to set of added or modified line numbers (based on the +new_start,new_count hunk headers). Files with deletion-only hunks appear in the result with an empty set, so reporters can distinguish "coverage not tracked" from "no changes touched this file."
cj/--coverage-changed-lines wraps that parser with scope dispatch. Scopes are working-tree, staged, branch-vs-main, and branch-vs-parent. Branch-vs-parent takes an optional BASE arg; if omitted, falls back to @{upstream}. Unknown scopes signal user-error.
Tests cover Normal (single hunk, multiple files), Boundary (new file via @@ -0,0, deletion-only, binary markers, single-line hunks without a count, empty input), and Error (malformed hunk headers skipped; unknown scope). Git invocation is stubbed via cl-letf in the smoke test so the parser logic is exercised without shelling out.
Part of the coverage-core work per docs/design/coverage.org.
Diffstat (limited to 'modules/archived')
0 files changed, 0 insertions, 0 deletions
