pub enum HeadState {
Branch {
refname: String,
short_name: String,
oid: Option<ObjectId>,
},
Detached {
oid: ObjectId,
},
Invalid,
}Expand description
The current state of HEAD.
Variants§
Branch
HEAD points to a branch via a symbolic ref (e.g. ref: refs/heads/main).
Fields
Detached
HEAD is detached — pointing directly at a commit.
Invalid
HEAD is in an invalid or unreadable state.
Implementations§
Source§impl HeadState
impl HeadState
Sourcepub fn branch_name(&self) -> Option<&str>
pub fn branch_name(&self) -> Option<&str>
Return the branch name if HEAD is on a branch.
Sourcepub fn is_detached(&self) -> bool
pub fn is_detached(&self) -> bool
Whether HEAD is detached.
Trait Implementations§
impl Eq for HeadState
impl StructuralPartialEq for HeadState
Auto Trait Implementations§
impl Freeze for HeadState
impl RefUnwindSafe for HeadState
impl Send for HeadState
impl Sync for HeadState
impl Unpin for HeadState
impl UnsafeUnpin for HeadState
impl UnwindSafe for HeadState
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