You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
627 B
Rust
25 lines
627 B
Rust
mod git;
|
|
|
|
extern crate libc;
|
|
|
|
fn main() {
|
|
let path = std::env::args_os().skip(1).next()
|
|
.expect("usage: libgit2-rs PATH");
|
|
|
|
let repo = git::Repository::open(&path)
|
|
.expect("opening repository");
|
|
|
|
let commit_oid = repo.reference_name_to_id("HEAD")
|
|
.expect("looking up 'HEAD' reference");
|
|
|
|
let commit = repo.find_commit(&commit_oid)
|
|
.expect("looking up commit");
|
|
|
|
let author = commit.author();
|
|
println!("{} <{}>\n",
|
|
author.name().unwrap_or("(none)"),
|
|
author.email().unwrap_or("none"));
|
|
|
|
println!("{}", commit.message().unwrap_or("(none)"));
|
|
}
|