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 | 47489e7c7fb16ca837e6b2581a6538af059de9e3 (patch) | |
| tree | d023819810039e46a63f73a5673692fd0510033e /modules/prog-webdev.el | |
| parent | 469ac2d64d6d098256e16a7c54b590559444dc5a (diff) | |
| download | dotemacs-47489e7c7fb16ca837e6b2581a6538af059de9e3.tar.gz dotemacs-47489e7c7fb16ca837e6b2581a6538af059de9e3.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/prog-webdev.el')
0 files changed, 0 insertions, 0 deletions
