Skip to main content

Module gitparse

Module gitparse 

Source
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.
GitTreeEntry
One raw git tree entry: mode string verbatim, name bytes, child id.
Person
A parsed git person line (author / committer / tagger).

Enums§

GitParseError
Structural parse failure (not policy — see module docs).
ModeMapping
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 author etc.).
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.