Skip to main content

Commits

Struct Commits 

Source
pub struct Commits<'repo> { /* private fields */ }
Expand description

Record and preview commits for one open repository.

Implementations§

Source§

impl<'repo> Commits<'repo>

Source

pub fn new(repo: &'repo Repository) -> Self

Bind commit operations to repo.

Source

pub fn repository(&self) -> &'repo Repository

Underlying repository.

Source

pub fn default_scope(&self) -> Result<CommitScope>

Default CommitScope from commit.autoStage (default auto-stage).

§Errors

Propagates config read failures.

Source

pub fn pending_message(&self) -> Result<Option<String>>

Default message for the next commit when merge or squash state supplies one.

§Errors

Propagates I/O and merge-state read failures.

Source

pub fn create( &self, options: &CommitOptions, progress: &mut dyn ProgressSink, cancel: &CancelToken, ) -> Result<CommitOutcome>

Record a commit using options.scope to decide how the index is prepared.

§Errors

See [crate::porcelain::commit::create_commit] and crate::porcelain::CommitError.

Source

pub fn plan( &self, options: &CommitOptions, progress: &mut dyn ProgressSink, cancel: &CancelToken, ) -> Result<CommitPlan>

Preview a commit for options.scope without mutating the repository.

§Errors

Same as Self::create.

Source

pub fn create_staged( &self, request: &CommitRequest, progress: &mut dyn ProgressSink, cancel: &CancelToken, ) -> Result<CommitOutcome>

Record a commit from the current index without auto-staging the worktree.

Equivalent to Self::create with CommitScope::Staged.

§Errors

Same as Self::create.

Source

pub fn prepare_bytes( &self, data: &CommitData, sign_override: Option<bool>, ) -> Result<Vec<u8>>

Serialize commit bytes from assembled CommitData, honoring signing config.

§Errors

Propagates signing and config failures.

Source

pub fn write_object( &self, data: &CommitData, sign_override: Option<bool>, ) -> Result<ObjectId>

Hash and store a commit object from CommitData.

§Errors

Same as Self::prepare_bytes, plus object-database write failures.

Trait Implementations§

Source§

impl<'repo> Clone for Commits<'repo>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'repo> Copy for Commits<'repo>

Source§

impl<'repo> Debug for Commits<'repo>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'repo> !RefUnwindSafe for Commits<'repo>

§

impl<'repo> !UnwindSafe for Commits<'repo>

§

impl<'repo> Forget for Commits<'repo>

§

impl<'repo> Freeze for Commits<'repo>

§

impl<'repo> Send for Commits<'repo>

§

impl<'repo> Sync for Commits<'repo>

§

impl<'repo> Unpin for Commits<'repo>

§

impl<'repo> UnsafeUnpin for Commits<'repo>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.