pub struct Commits<'repo> { /* private fields */ }Expand description
Record and preview commits for one open repository.
Implementations§
Source§impl<'repo> Commits<'repo>
impl<'repo> Commits<'repo>
Sourcepub fn new(repo: &'repo Repository) -> Self
pub fn new(repo: &'repo Repository) -> Self
Bind commit operations to repo.
Sourcepub fn repository(&self) -> &'repo Repository
pub fn repository(&self) -> &'repo Repository
Underlying repository.
Sourcepub fn default_scope(&self) -> Result<CommitScope>
pub fn default_scope(&self) -> Result<CommitScope>
Default CommitScope from commit.autoStage (default auto-stage).
§Errors
Propagates config read failures.
Sourcepub fn pending_message(&self) -> Result<Option<String>>
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.
Sourcepub fn create(
&self,
options: &CommitOptions,
progress: &mut dyn ProgressSink,
cancel: &CancelToken,
) -> Result<CommitOutcome>
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.
Sourcepub fn plan(
&self,
options: &CommitOptions,
progress: &mut dyn ProgressSink,
cancel: &CancelToken,
) -> Result<CommitPlan>
pub fn plan( &self, options: &CommitOptions, progress: &mut dyn ProgressSink, cancel: &CancelToken, ) -> Result<CommitPlan>
Sourcepub fn create_staged(
&self,
request: &CommitRequest,
progress: &mut dyn ProgressSink,
cancel: &CancelToken,
) -> Result<CommitOutcome>
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.
Sourcepub fn prepare_bytes(
&self,
data: &CommitData,
sign_override: Option<bool>,
) -> Result<Vec<u8>>
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.
Sourcepub fn write_object(
&self,
data: &CommitData,
sign_override: Option<bool>,
) -> Result<ObjectId>
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.