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: StringCommit 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 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: boolWhen 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: boolReplace 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: boolWhen 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: HookPolicyHook execution policy for pre-commit and commit-msg.
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: boolAppend Signed-off-by using the committer identity (-s / --signoff).
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: boolWhen true, compute the commit tree and file list without writing objects, updating refs, or running hooks.
post_rewrite: PostOperationHooksWhether an amend runs post-rewrite amend (PostOperationHooks::Skip is Git’s
--no-post-rewrite). post-commit runs either way.