Skip to main content

Crate sley_object

Crate sley_object 

Source
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.
CommitCreate
CommitRef
A borrowed parse-view of a raw commit object.
EncodedObject
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
TreeBuilder
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.
TreeEntries
Fallibly iterates raw tree-object bytes without allocating entry names.
TreeEntry
TreeEntryRef
A borrowed parse-view of a single entry in a raw tree object.

Enums§

EntryKind
The five entry kinds Git allows inside a tree, each mapping to a fixed mode.
IdentityConfig
Explicit effective config used as the identity fallback. Skip means the caller already has both fields from the environment, so config lookup is unnecessary; Loaded borrows the invocation’s already-resolved snapshot.
ObjectType

Functions§

canonicalize_commit_date
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.
commit_identity_from_env
commit_identity_from_env_with_date
Like commit_identity_from_env but with the date forced to date_override (any form canonicalize_commit_date accepts), keeping the env/config name+email resolution unchanged. Used by git 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_date but returns None when the value does not parse — used for git commit --date= so we can die with fatal: invalid date format: … matching git’s parse_force_date.
validate_commit_identity_name