Expand description
Tolerant parsers for ARBITRARY git object bytes (SPEC-GIT-IMPORT §2, §3).
This is the import direction’s untrusted-input boundary, and its
contract is the opposite of crate::reconstruct’s: reconstruct
is strict by design (it proves bridge shape and MUST stay that
way); these parsers accept everything git itself accepts —
multi-line continuation headers (gpgsig, mergetag), unknown
headers, the encoding header, historic malformed person lines —
and either parse faithfully or refuse loudly. They never crash on
malformed input and never silently alter bytes (fuzzed; see
FUZZ.md).
Parsers stop at structure: policy (mode normalization vs fork-mode
refusal, name legality, timestamp range) lives in the import
driver, which maps GitParseError / parsed values onto
crate::error::Refusal.
Structs§
- GitCommit
- A parsed (arbitrary) git commit.
- GitTag
- A parsed (arbitrary) git annotated tag.
- GitTree
Entry - One raw git tree entry: mode string verbatim, name bytes, child id.
- Person
- A parsed git person line (
author/committer/tagger).
Enums§
- GitParse
Error - Structural parse failure (not policy — see module docs).
- Mode
Mapping - SPEC-GIT-IMPORT §3.3 mode policy outcome.
Constants§
- MAX_
HEADER_ BLOCK - Hard cap on a commit/tag header block (everything before the blank line). Real gpgsig/mergetag blocks are a few KiB; 10 MiB refuses pathological input before any allocation amplification.
Functions§
- map_
mode - Classify a git tree-entry mode string per the pinned §3.3 table.
- parse_
commit - Parse arbitrary git commit body bytes (after the object header).
- parse_
person - Parse a person-line VALUE (the bytes after
authoretc.). - parse_
tag - Parse arbitrary git tag body bytes.
- parse_
tree - Parse arbitrary git tree body bytes. Purely structural — mode policy (canonical/normalize/refuse) is the driver’s.