From 4be56ee336b52b6912b2b08d84074b969ae5efb2 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sun, 29 Dec 2019 00:56:20 +0100 Subject: Adding a small limgit2 example usage --- .gitignore | 1 + src/main.rs | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 53eaa21..91ea909 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target **/*.rs.bk +testrepo \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 77288a7..ed633e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ mod repo; fn main() -> std::io::Result<()> { // use actix_files as fs; // use actix_web::{web, App, HttpServer}; - + // start http server // HttpServer::new(move || { // App::new() @@ -14,6 +14,20 @@ fn main() -> std::io::Result<()> { // .bind("127.0.0.1:8080")? // .run()?; - //let r = repo::Repo::new("./test"); + let r = repo::Repo::new("./testrepo"); + let mut walker = r.inner.revwalk().unwrap(); + walker.push_head().unwrap(); + dbg!(walker + .into_iter() + .map(|oid| { + let oid = oid.unwrap(); + r.inner + .find_commit(oid) + .unwrap() + .message() + .unwrap() + .to_owned() + }) + .collect::>()); Ok(()) } -- cgit v1.2.3