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).
Commit creation from the index (write-tree, object write, ref/reflog updates)
lives in crate::porcelain::commit; the grit commit command stages paths
then calls that API.
Library guide: commit
use grit_lib::repo::{InitOptions, Repository};
let dir = tempfile::tempdir()?;
let _repo = Repository::init(dir.path(), &InitOptions::default())?;Modules§
- encoding
- Commit encoding helpers for non-UTF-8 commit messages.
- signing
- OpenPGP / SSH signature verification.
- trailers
- Commit trailers and interpretation helpers.
Structs§
- Trailer
ArgParse Error - Error when a
--trailerargument is notkey=valueorkey: value.
Functions§
- assemble_
identity - Assemble a commit identity line (
Name <email> <epoch> <offset>) from an already-resolved name and email plus a timestamp. - format_
git_ timestamp - Format a timestamp in Git’s format:
<epoch> <offset>. - normalize_
commit_ date_ override - Normalise a user-supplied author/committer date (CLI
--date, env overrides) into Git’s stored<epoch> <±HHMM>form. - parse_
date_ to_ git_ timestamp - Normalise a date string into Git’s stored
<epoch> <offset>timestamp. - parse_
trailer_ command_ line_ arg - Split a
git commit --trailerargument into token and value.