Juggernaut.Plan.Hunks (Juggernaut v0.4.0)

Copy Markdown View Source

Changed lines from git diff -U0 output, and which function clauses they touch (design notes §3 --since, plan I11).

Only the new side of each hunk counts: @@ -a,b +c,d @@ changes lines c..c+d-1 of the new file. A hunk that only deletes (d = 0) touches the lines on both sides of the deletion (c and c + 1), so removing code inside a clause selects that clause. A deleted file (+++ /dev/null) has no lines. A header whose new side is not c or c,d (digits) adds nothing.

Summary

Functions

Changed lines per file (paths as git prints them after b/, unquoted).

Whether any of changed lies in range.

Types

t()

@type t() :: %{required(String.t()) => MapSet.t(pos_integer())}

Functions

parse(diff)

@spec parse(String.t()) :: t()

Changed lines per file (paths as git prints them after b/, unquoted).

touched?(range, changed)

@spec touched?(Range.t(), MapSet.t(pos_integer())) :: boolean()

Whether any of changed lies in range.