Skip to main content

Module diff

Module diff 

Source
Expand description

Unified-diff model built from git2.

DiffModel captures exactly what coverage attribution needs from a diff: per file, the set of added (new-side) line numbers, and a deterministic base↔head alignment for unchanged lines so coverage can be compared across versions without heuristics. Added lines come from the + lines of the diff; the alignment is derived from hunk offsets (@@ -a,b +c,d @@) plus the exact context-line pairs git2 reports inside each hunk.

Rename detection is enabled so a moved file is diffed against its original content — added lines and “lost coverage” are attributed correctly instead of the whole file looking new.

Structs§

DiffModel
A whole diff: the set of changed files between two revisions.
FileDiff
Per-file diff information.

Functions§

default_base_ref
Resolves the default base ref: the merge-base of origin/main (falling back to main) and HEAD, returned as a hex SHA.