Adding some more

text

- bullets

and all that
This commit is contained in:
Kasper Juul Hermansen 2022-11-06 13:57:10 +01:00
parent 235a6a723f
commit a449640ed5
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23

View File

@ -1,12 +1,21 @@
use git2::Repository; use git2::Repository;
fn main() -> eyre::Result<()> { fn main() -> eyre::Result<()> {
let repo = Repository::open(".")?; let repo = Repository::open(".git")?;
let mut revwalk = repo.revwalk()?; let mut revwalk = repo.revwalk()?;
revwalk.set_sorting(git2::Sort::TIME)?; revwalk.set_sorting(git2::Sort::TIME)?;
let revspec = repo.revparse("HEAD")?;
let from = revspec.from().ok_or(eyre::anyhow!("could not get HEAD"))?;
revwalk.push(from.id())?;
for rev in revwalk.enumerate() { for rev in revwalk.enumerate() {
println!("rev: {})", rev.1?.to_string()) let oid = rev.1?;
let commit = repo.find_commit(oid)?;
let message = commit
.message()
.ok_or(eyre::anyhow!("could not find message from commit"))?;
println!("rev: {}", message)
} }
Ok(()) Ok(())