Skip to main content

parse_commit_output_with_files

Function parse_commit_output_with_files 

Source
pub fn parse_commit_output_with_files(output: &str) -> Vec<CommitWithFiles>
Expand description

Parse git log --name-only output (metadata formatted as %H%x1f...%b%x1e, followed by one touched-file path per line) into CommitWithFiles.

git emits each commit as <metadata>\x1e\n<file>\n<file>\n\n (the touched files follow the %x1e-terminated metadata, then a blank line). Splitting on \x1e yields [metadata_0, "\n<files_0>\n\n<metadata_1>", ...]: the file block trailing each record up to the next metadata belongs to THAT record’s commit.

The metadata record is multi-line because %b (the commit body) carries newlines, so the record runs from the first \x1f-bearing line through the end of the segment — NOT just the first matching line. Truncating to one line would drop body trailers (e.g. Co-Authored-By:) for every commit after the first, diverging from the full-body parse the changelog stage’s parse_git_log_records performs.