Skip to main content

CommitRequest

Struct CommitRequest 

Source
pub struct CommitRequest {
Show 15 fields pub message: String, pub author: Option<Signature>, pub committer: Option<Signature>, pub allow_empty: bool, pub sign_override: Option<bool>, pub amend: bool, pub assume_worktree_synced: bool, pub hooks: HookPolicy, pub author_date: Option<String>, pub trailers: Vec<(String, String)>, pub signoff: bool, pub reset_author: bool, pub reuse_message_from: Option<ObjectId>, pub dry_run: bool, pub post_rewrite: PostOperationHooks, /* private fields */
}
Expand description

Inputs for create_commit.

Fields§

§message: String

Commit message body (first line becomes the subject). A trailing newline is added when missing.

The message is also written to .git/COMMIT_EDITMSG for the commit-msg hook. The file is read back only when that hook ran, so concurrent committers sharing the file never record each other’s message.

§author: Option<Signature>

Author to record. None keeps the replaced commit’s author for Self::amend and the source commit’s author for Self::reuse_message_from; otherwise the repository’s author identity (Repository::identity) is used. Self::author_date and Self::reset_author still apply.

§committer: Option<Signature>

Committer to record; None uses the repository’s committer identity (Repository::identity).

§allow_empty: bool

When false (default), reject commits whose tree equals the parent’s tree or is the empty tree on an unborn branch.

§sign_override: Option<bool>

When Some(true), sign even if commit.gpgsign is false; when Some(false), skip signing even when config requests it. When None, honor commit.gpgsign.

§amend: bool

Replace the current branch tip: parents and author come from the tip being replaced; an empty Self::message reuses that commit’s message. Same-tree amends are allowed.

§assume_worktree_synced: bool

When true, skip the post-commit full-tree index stat refresh because the caller already synced the index from the worktree (for example via crate::porcelain::add::stage_for_commit).

commit_worktree and every commit_with_scope scope set this themselves, since their staging pass already refreshed the index; only create_commit callers need to choose.

§hooks: HookPolicy

Hook execution policy for pre-commit and commit-msg.

§author_date: Option<String>

Author timestamp suffix (<unix> <+HHMM>) replacing the author line date when set.

§trailers: Vec<(String, String)>

Trailers to append via process_trailers (same semantics as git commit --trailer).

§signoff: bool

Append Signed-off-by using the committer identity (-s / --signoff).

§reset_author: bool

Use the committer as the author with a fresh author date (--reset-author).

§reuse_message_from: Option<ObjectId>

Reuse log message and author from this commit (-C / --reuse-message); copies get a new change id.

§dry_run: bool

When true, compute the commit tree and file list without writing objects, updating refs, or running hooks.

§post_rewrite: PostOperationHooks

Whether an amend runs post-rewrite amend (PostOperationHooks::Skip is Git’s --no-post-rewrite). post-commit runs either way.

Trait Implementations§

Source§

impl Clone for CommitRequest

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 Debug for CommitRequest

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CommitRequest

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.