pub fn diff_line_counts(
old_bytes: &[u8],
new_bytes: &[u8],
) -> Option<(usize, usize)>Expand description
Added / deleted line counts between two blobs, from the same Myers edit
script the unified patch uses. None when either side is binary —
matching Git’s heuristic of a NUL byte within the first 8000 bytes
(independent of UTF-8 validity), so diff --stat renders Bin … for
exactly the blobs Git would.
Used by diff --stat; kept here so the stat counts always agree with
the +/- lines text_patch would emit for the same blobs. Lines are
split on \n bytes, so the counts hold for any non-binary blob, including
non-UTF-8 text.