pub struct GitObservation {
pub branch: Option<String>,
pub head: Option<String>,
pub clean: bool,
pub changed: u32,
}Expand description
What git said about the work tree, taken from the snapshot’s one git status rather than
asked again.
use majordomus_cli::environment::preflight::{derive, GitObservation, Observations, Verdict};
let mut o = Observations::empty("demo", 0);
assert_eq!(derive(&o).check("repository.git").unwrap().verdict, Verdict::Unavailable);
o.git = Some(GitObservation { branch: None, head: Some("a".repeat(40)), clean: false, changed: 3 });
let git = derive(&o);
let c = git.check("repository.git").unwrap();
assert_eq!(c.verdict, Verdict::Active);
assert!(c.summary.contains("detached") && c.summary.contains("3 path(s) changed"));Fields§
§branch: Option<String>The branch, when HEAD names one.
head: Option<String>The commit HEAD names.
clean: boolWhether nothing is staged, modified, untracked or conflicted.
changed: u32Paths that are not clean.
Trait Implementations§
Source§impl Clone for GitObservation
impl Clone for GitObservation
Source§fn clone(&self) -> GitObservation
fn clone(&self) -> GitObservation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GitObservation
impl Debug for GitObservation
Source§impl Default for GitObservation
impl Default for GitObservation
Source§fn default() -> GitObservation
fn default() -> GitObservation
Returns the “default value” for a type. Read more
impl Eq for GitObservation
Source§impl PartialEq for GitObservation
impl PartialEq for GitObservation
Source§fn eq(&self, other: &GitObservation) -> bool
fn eq(&self, other: &GitObservation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for GitObservation
Auto Trait Implementations§
impl Freeze for GitObservation
impl RefUnwindSafe for GitObservation
impl Send for GitObservation
impl Sync for GitObservation
impl Unpin for GitObservation
impl UnsafeUnpin for GitObservation
impl UnwindSafe for GitObservation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.