Struct git2::Reflog

source ·
pub struct Reflog { /* private fields */ }
Expand description

A reference log of a git repository.

Implementations§

source§

impl Reflog

source

pub fn append( &mut self, new_oid: Oid, committer: &Signature<'_>, msg: Option<&str> ) -> Result<(), Error>

Add a new entry to the in-memory reflog.

source

pub fn remove( &mut self, i: usize, rewrite_previous_entry: bool ) -> Result<(), Error>

Remove an entry from the reflog by its index

To ensure there’s no gap in the log history, set rewrite_previous_entry param value to true. When deleting entry n, member old_oid of entry n-1 (if any) will be updated with the value of member new_oid of entry n+1.

source

pub fn get(&self, i: usize) -> Option<ReflogEntry<'_>>

Lookup an entry by its index

Requesting the reflog entry with an index of 0 (zero) will return the most recently created entry.

source

pub fn len(&self) -> usize

Get the number of log entries in a reflog

source

pub fn is_empty(&self) -> bool

Return true is there is no log entry in a reflog

source

pub fn iter(&self) -> ReflogIter<'_>

Get an iterator to all entries inside of this reflog

source

pub fn write(&mut self) -> Result<(), Error>

Write an existing in-memory reflog object back to disk using an atomic file lock.

Trait Implementations§

source§

impl Drop for Reflog

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Reflog

§

impl !Send for Reflog

§

impl !Sync for Reflog

§

impl Unpin for Reflog

§

impl UnwindSafe for Reflog

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.