diff --git a/src/log.rs b/src/log.rs index 707570f..73ea475 100644 --- a/src/log.rs +++ b/src/log.rs @@ -13,7 +13,14 @@ impl Repository { let commit_desc = commit.string()?; let lines = commit_desc.lines().collect::>(); - println!("{} {}", hex::encode(current_commit), lines[lines.len() - 1]); + // find the first empty line + let first_empty_line = lines.iter().position(|line| line.is_empty()); + + println!( + "{} {}", + hex::encode(current_commit), + lines[first_empty_line.unwrap() + 1] + ); let parent_commit_id = lines.iter().find(|line| line.starts_with("parent ")); if parent_commit_id.is_none() {