feat(log): show first log line
All checks were successful
CI checks / Clippy (push) Successful in 27s
CI checks / Format (push) Successful in 25s

This commit is contained in:
Patrick MARIE 2025-02-06 23:43:25 +01:00
parent 8c6994986c
commit 1d8009cad1
Signed by: mycroft
GPG Key ID: BB519E5CD8E7BFA7

View File

@ -13,7 +13,14 @@ impl Repository {
let commit_desc = commit.string()?;
let lines = commit_desc.lines().collect::<Vec<&str>>();
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() {