Skip to main content

Module utils

Module utils 

Source
Expand description

Shared pack-parsing helpers for reading object headers, varints, offsets, and zlib-compressed payloads as defined by Git’s pack format.

Functions§

calculate_object_hash
Calculate the SHA1 hash of the given object.
<type> <size>\0<content>
data: The decompressed content of the object
count_dir_files
Count the number of files in a directory and its subdirectories.
create_empty_dir
Create an empty directory or clear the existing directory.
is_eof
Checks if the reader has reached EOF (end of file).
read_byte_and_check_continuation
Reads a byte from the given stream and checks if there are more bytes to continue reading.
read_bytes
Read the next N bytes from the reader
read_delta_object_size
Reads the base size and result size of a delta object from the given stream.
read_offset_encoding
The offset for an OffsetDelta object(big-endian order)
read_partial_int
Reads a partial integer from a stream. (little-endian order)
read_type_and_varint_size
Reads bytes from the stream and parses the first byte for type and size. Subsequent bytes are read as size bytes and are processed as variable-length integer in little-endian order. The function returns the type and the computed size.
read_varint_le
Reads a variable-length integer (VarInt) encoded in little-endian format from a source implementing the Read trait.