From 81ae20b5a0bca84166076d91b8b32a19d2d451ae Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sat, 28 Dec 2019 23:58:14 +0100 Subject: Refactoring basic project structure --- src/repo.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/repo.rs') diff --git a/src/repo.rs b/src/repo.rs index e69de29..0056575 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -0,0 +1,45 @@ +use git2::Repository; + + +// /// Represents a repository on disk +// struct Repository { +// /// We need to be able to query libgit2 later +// fs_path: String, +// /// The project name (last path element) +// name: String, +// /// The rope path excluding the name +// path: Vec, +// } + +/// A structure that represents an existing bare repo on disk +pub struct Repo { + pub inner: Repository, +} + +impl Repo { + pub fn new(path: &'static str) -> Self { + Self { + inner: Repository::open_bare(path).unwrap(), + } + } + + /// Returns a list of commit hashes for a project + pub fn commits(&self) -> Vec { + vec!["f6ca929", "43fb776", "1a0fa2f".into()] + .into_iter() + .map(String::from) + .collect() + } + + /// Return the list of contributors + fn contributors(&self) -> Vec { + vec![ + "Katharina Fey ", + ] + .into_iter() + .map(String::from) + .collect() + } +} -- cgit v1.2.3