aboutsummaryrefslogtreecommitdiff
path: root/src/repo.rs
blob: 0056575545e8d7420d7d75148339b674f76f4bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()
    }
}