Skip to main content

Module commit

Module commit 

Source
Expand description

Commit-metadata helpers shared by the porcelain commands.

This module holds pure-domain pieces of commit creation that compute a result from plain inputs and carry no presentation, argv, or process state. The first piece extracted is the date normalisation used to fill the author/committer timestamp: turning a user-supplied --date string (or GIT_AUTHOR_DATE / GIT_COMMITTER_DATE) into Git’s stored <epoch> <offset> form. It is shared by commit, commit --amend, and the sequencer commands (rebase, cherry-pick, revert, stash, notes, tag, format-patch, checkout).

The larger commit-object assembly (tree-from-index, parent selection, message editing, hook dispatch, HEAD/reflog updates) still lives in the grit binary’s commands/commit.rs; it is interleaved with editor launch, hook timing, and exit-code decisions and is extracted separately.

Functions§

format_git_timestamp
Format a timestamp in Git’s format: <epoch> <offset>.
parse_date_to_git_timestamp
Normalise a date string into Git’s stored <epoch> <offset> timestamp.