Skip to main content

canonicalize_commit_date

Function canonicalize_commit_date 

Source
pub fn canonicalize_commit_date(date: &str) -> String
Expand description

Canonicalise a GIT_*_DATE/--date= value to git’s raw <seconds> +HHMM form so the sequencer’s identity builder (which only accepts the raw form) stores the same bytes git would.

git’s commit-tree / commit run author and committer dates through parse_date / approxidate_careful, accepting ISO-8601 (2005-04-07T22:13:13), <date> <time> <tz>, RFC-2822, fuzzy approxidates, and the raw form. Values that do not parse are passed through verbatim so callers that only need best-effort conversion (env GIT_*_DATE) still get a diagnostic from the identity formatter; prefer try_canonicalize_commit_date when a hard reject with git’s invalid date format message is required (--date=).