Skip to main content

parse_commit_message

Function parse_commit_message 

Source
pub fn parse_commit_message(body: &str) -> ParsedCommit
Expand description

Parse one commit body — subject on the first line, optional note paragraph, then a trailer block. Trailers are recognised as lines matching <Capitalized>: <value>. The note is everything between the subject (after one blank line) and the first trailer (or end of body if none).

Body input is the raw commit message including subject — the same shape git log --format=%B returns. Trailing newlines are tolerated.

Empty / whitespace-only bodies produce a ParsedCommit with an empty subject and every other field None — callers decide whether that counts as skippable.