Skip to main content

parse_canonical

Function parse_canonical 

Source
pub fn parse_canonical(data: &[u8]) -> Option<GitObject<'_>>
Expand description

Parse "<type> <size>\0<content>".

Returns None — never panics — when the header is absent, the type is not one of the four, the size is not decimal, or the declared size disagrees with the actual payload length. That last check is what makes a truncated or padded entry a miss rather than a silently wrong object_size.