pub fn commit_worktree(
repo: &Repository,
req: &CommitRequest,
progress: &mut dyn ProgressSink,
cancel: &dyn Cancel,
) -> Result<CommitOutcome>Expand description
Stage every worktree change and record a commit using a single in-memory index (issue #1064).
Avoids an extra index load/write between implicit staging and commit tree construction. The
staging pass is the only work-tree scan: it refreshes the stat data of every tracked entry, so
the commit always runs as if CommitRequest::assume_worktree_synced were set.
When staging changed the index but the result matches the parent tree (for example a new
file that was staged and then deleted from the work tree), the staged index is still written
before Error::NothingToCommit is returned, so the on-disk index matches HEAD afterwards.
CommitRequest::dry_run never writes the index, refs, or stored objects. Symlinks are
compared and previewed as link-target bytes, including directory and dangling links.
Staging reports crate::progress::ProgressPhase::StagingFiles and polls cancel; a cancel
during staging returns Error::Cancelled with the on-disk index, HEAD and refs unchanged.
ยงErrors
Same as create_commit, plus staging failures from crate::porcelain::add::stage_for_commit.