Skip to main content

build_fragmap

Function build_fragmap 

Source
pub fn build_fragmap(commit_diffs: &[CommitDiff], deduplicate: bool) -> FragMap
Expand description

Build a fragmap from a collection of commits and their diffs.

Implements the Span Propagation Graph (SPG) algorithm from the original fragmap tool. For each file, a DAG is built where active nodes (hunks) and inactive nodes (propagated surviving spans) are connected by overlap edges. Columns correspond to unique paths through the DAG, with each path’s active nodes determining which commits have CHANGE in that column. Build a fragmap from a list of commit diffs.

When deduplicate is true (the normal view), columns whose set of touching commits is identical are merged into one, producing a compact matrix. Pass false to keep every raw hunk cluster as its own column, which is useful for debugging the cluster layout.