diff options
author | Katharina Fey <kookie@spacekookie.de> | 2019-12-28 23:58:14 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2019-12-28 23:58:14 +0100 |
commit | 81ae20b5a0bca84166076d91b8b32a19d2d451ae (patch) | |
tree | 54de2fed2f08ff7f65eb709686f72d76bd34ad66 /src/repo.rs | |
parent | baf496acf0640fecdc01864989f2142a9757ba14 (diff) |
Refactoring basic project structure
Diffstat (limited to '')
-rw-r--r-- | src/repo.rs | 45 |
1 files changed, 45 insertions, 0 deletions
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<String>, +// } + +/// 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<String> { + vec!["f6ca929", "43fb776", "1a0fa2f".into()] + .into_iter() + .map(String::from) + .collect() + } + + /// Return the list of contributors + fn contributors(&self) -> Vec<String> { + vec![ + "Katharina Fey <kookie@spacekookie.de", + "Robin Example <robin@example.com", + "Ferris <ferris@the.crab>", + ] + .into_iter() + .map(String::from) + .collect() + } +} |