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
46
47
48
49
50
51
use std::collections::HashMap;
use std::path::PathBuf;
use chrono::prelude::*;
use git_url_parse::GitUrl;
#[derive(Clone, Debug, PartialEq)]
pub enum GitCredentials {
SshKey {
username: String,
public_key: Option<PathBuf>,
private_key: PathBuf,
passphrase: Option<String>,
},
UserPassPlaintext {
username: String,
password: String,
},
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct GitRepo {
pub url: GitUrl,
pub head: Option<GitCommitMeta>,
pub credentials: Option<GitCredentials>,
pub branch: Option<String>,
pub path: Option<PathBuf>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct GitCommitMeta {
pub id: String,
pub message: Option<String>,
pub timestamp: Option<DateTime<Utc>>,
}
pub type BranchHeads = HashMap<String, GitCommitMeta>;