pub fn group_footer(text: &str) -> StringExpand description
Separate the trailing run of footer lines, drop blanks inside it, and put exactly one blank line before the group.
The run deliberately crosses BLANK lines, which is what merges a
BREAKING CHANGE: paragraph and a Co-Authored-By: paragraph into one
footer block. That is a feature, not an accident, so this is not a
“last paragraph only” rule.
The scan starts at lines[1..]: line 0 is the SUBJECT and can never be a
footer, whatever it happens to look like. Without that anchor a subject
misread as a footer (see is_hyphenated_key) let the run consume the entire
message, split_at became 0, and the subject was emitted INSIDE the footer
group with a blank line in front of it — destroying every trailer in the
commit. lines[1..] makes split_at >= 1 by construction; split('\n')
never yields an empty vector, so the slice is always in range, and a
single-line message falls out of the general path producing exactly what it
produced before (out = [subject, ""]).