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
//! # types
//!
//! Public library types.
//!

#[cfg(test)]
#[path = "./types_test.rs"]
mod types_test;

use std::collections::HashMap;

#[derive(Debug, Clone)]
/// Holds git info for the given repo directory
pub struct GitInfo {
    /// User name
    pub user_name: Option<String>,
    /// User email
    pub user_email: Option<String>,
    /// True if there are non commited changes
    pub dirty: Option<bool>,
    /// Config key/value map
    pub config: Option<HashMap<String, String>>,
    /// Current branch name
    pub current_branch: Option<String>,
    /// All branch names
    pub branches: Option<Vec<String>>,
}

impl GitInfo {
    /// Returns new instance
    pub fn new() -> GitInfo {
        GitInfo {
            user_name: None,
            user_email: None,
            dirty: None,
            config: None,
            current_branch: None,
            branches: None,
        }
    }
}