Expand description
git-object — Git’s object model: commits, trees, tags, and the raw encoded object framing they share.
This crate carries the in-memory representations of Git’s four object types
(Commit, Tree, Tag, and the blob payload carried inside
EncodedObject) together with their parse/serialize routines and the
parse_framed_object helper that decodes the "<type> <len>\0<body>"
loose-object frame.
Commit and Tag are parsed, canonical representations of the headers
this crate understands. They are convenient for structured edits, but they
are not byte-lossless round-trippers for signed objects, custom headers, or
other raw object body details. Use EncodedObject whenever exact object
bytes, object ids, or framed-object bytes must be preserved.
Structs§
- BString
- A byte string for git paths and similar on-disk identifiers.
- Commit
- A parsed, canonical representation of the commit headers this crate understands.
- Commit
Create - Commit
Ref - A borrowed parse-view of a raw commit object.
- Encoded
Object - Tag
- A parsed, canonical representation of the annotated tag headers this crate understands.
- TagRef
- A borrowed parse-view of a raw annotated tag object.
- Tree
- Tree
Builder - Builds a single tree level: deduplicates entries by name and emits them in Git’s canonical order so the written object is byte-identical to Git’s.
- Tree
Entries - Fallibly iterates raw tree-object bytes without allocating entry names.
- Tree
Entry - Tree
Entry Ref - A borrowed parse-view of a single entry in a raw tree object.
Enums§
- Entry
Kind - The five entry kinds Git allows inside a tree, each mapping to a fixed mode.
- Identity
Config - Explicit effective config used as the identity fallback.
Skipmeans the caller already has both fields from the environment, so config lookup is unnecessary;Loadedborrows the invocation’s already-resolved snapshot. - Object
Type
Functions§
- canonicalize_
commit_ date - Canonicalise a
GIT_*_DATE/--date=value to git’s raw<seconds> +HHMMform so the sequencer’s identity builder (which only accepts the raw form) stores the same bytes git would. - commit_
identity_ from_ env - commit_
identity_ from_ env_ with_ date - Like
commit_identity_from_envbut with the date forced todate_override(any formcanonicalize_commit_dateaccepts), keeping the env/config name+email resolution unchanged. Used bygit am --committer-date-is-author-date, which keeps the environment committer name/email but substitutes the author date. - commit_
identity_ name_ crud - commit_
reflog_ message - commit_
reflog_ message_ with_ initial - commit_
signoff_ from_ env - committer_
identity_ for_ reflog - default_
commit_ date - default_
committer - encode_
commit_ object - Validate and serialize a commit request into an encodable object: parent /
tree formats must agree, the canonical commit body is written, and an
optional detached signature is folded under git’s
gpgsig(gpgsig-sha256) continuation-header convention. - format_
commit_ identity - Format a name/email/date triple as git’s raw ident line
(
Name <email> <seconds> +HHMM), rejecting control bytes in either component and anything but the raw date form. - format_
commit_ identity_ bytes - identity_
config_ value - Resolve an identity config key (
user.name/user.email) following git’s precedence below the environment:-c/GIT_CONFIG_*command-line overrides first, then the effective config (repository, then global, then system). - identity_
config_ value_ for_ role - identity_
default_ value - identity_
use_ config_ only - identity_
use_ config_ only_ error - parse_
framed_ object - print_
identity_ unknown_ hint - tree_
entry_ cmp - Order two tree entries the way Git canonically sorts them: by name bytes,
except that a subtree sorts as though its name ended in
/. Writing a tree whose entries are in any other order produces a different (wrong) OID. - tree_
entry_ object_ type - try_
canonicalize_ commit_ date - Like
canonicalize_commit_datebut returnsNonewhen the value does not parse — used forgit commit --date=so we can die withfatal: invalid date format: …matching git’sparse_force_date. - validate_
commit_ identity_ name