summaryrefslogtreecommitdiff
path: root/lib/libgfold/src/status.rs
blob: e6e104a2298b1733aa213e451f319112e2de895d (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
//! This module contains the [`crate::status::Status`] type.

use serde::{Deserialize, Serialize};

/// A summarized interpretation of the status of a Git working tree.
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum Status {
    Bare,
    Clean,
    Unclean,
    Unknown,
    Unpushed,
}

impl Status {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Bare => "bare",
            Self::Clean => "clean",
            Self::Unclean => "unclean",
            Self::Unknown => "unknown",
            Self::Unpushed => "unpushed",
        }
    }
}