class documentation
A block containing reference records.
| Class Method | decode |
Decode a ref block from bytes - simplified. |
| Method | __init__ |
Initialize RefBlock. |
| Method | add |
Add a reference to the block. |
| Method | encode |
Encode the ref block with restart points for Git compatibility. |
| Instance Variable | refs |
Undocumented |
| Class Method | _find |
Find where ref records end in the data. |
| Method | _create |
Create the embedded footer pattern Git uses. |
def encode(self, min_update_index:
int = 0, embed_footer: bool = False, header_data: bytes = b'') -> bytes:
¶
Encode the ref block with restart points for Git compatibility.
Find where ref records end in the data.
Git embeds a footer at the end of ref blocks that contains offset information. This footer is marked by a special pattern (0x00 0x00 0x1c) where 0x1c (28) represents the version 2 header size.
| Parameters | |
data:bytes | The raw block data to search |
| Returns | |
int | The position where ref records end and footer begins |