Expand description
Move detection for git diff --color-moved (port of git/diff.c
add_lines_to_move_detection + mark_color_as_moved + dim_moved_lines).
Operates on the already-rendered plain unified diff text (one or more files
of diff --git headers, @@ hunk headers, and +/-/context body lines).
It identifies blocks of moved code and returns, for every line of the input
patch, a MovedClass telling the colorizer which color slot to use.
Enums§
- Color
Moved Mode --color-movedmode.- Moved
Class - The color class assigned to one emitted line after move detection.
Constants§
- MOVED_
WS_ ALLOW_ INDENTATION_ CHANGE - MOVED_
WS_ ERROR - MOVED_
WS_ IGNORE_ ALL_ SPACE - MOVED_
WS_ IGNORE_ SPACE_ AT_ EOL - MOVED_
WS_ IGNORE_ SPACE_ CHANGE
Functions§
- detect_
moved_ lines - Run move detection over a plain multi-file unified diff. Returns a vector
parallel to the patch’s lines (
patch.split_inclusive('\n')) giving each line’sMovedClass; non-+/- lines are alwaysMovedClass::None. - parse_
color_ moved_ ws - Parse a comma-separated
--color-moved-ws=<modes>value into the bit flags. SetsMOVED_WS_ERRORfor unknown modes or the illegal allow-indentation-change + other-ws combination (git errors out then).