Skip to main content

parse_tree_records

Function parse_tree_records 

Source
pub fn parse_tree_records(
    output: &[u8],
) -> Result<Vec<TreeRecord>, CandidateError>
Expand description

What: Parse a complete git ls-tree -r -z listing. Result<Vec<TreeRecord>, CandidateError> is “every record, or the first failure”. Why: A listing that does not end with NUL was cut short; a partial list would read a file HEAD holds as new, so the whole listing is refused.

In TS you’d write (pseudocode):

function parseTreeRecords(output: Buffer): TreeRecord[];