Skip to main content

render

Function render 

Source
pub fn render(
    diff_text: &str,
    max_move_gap: MoveGap,
    color: bool,
) -> Result<String>
Expand description

Render diff_text (as produced by git diff) with move/reformat annotations.

max_move_gap bounds how many real (non-reflow) content changes are tolerated inside an otherwise-moved block before extension gives up. color enables ANSI colors.

Falls back to printing a file’s own diff entry unannotated (with a warning on stderr) if that entry can’t be parsed (e.g. a binary diff, mode-only change, or pure rename), rather than failing outright or discarding annotations for the rest of the diff — this is best-effort tooling on top of git diff, and one file’s parser limitation shouldn’t make every other file’s diff unreadable.