feat: adding hash-object
All checks were successful
CI checks / Clippy (push) Successful in 27s
CI checks / Format (push) Successful in 25s

This commit is contained in:
2025-02-08 23:16:24 +01:00
parent daf5fa3272
commit de4c366ebb
4 changed files with 65 additions and 11 deletions

View File

@@ -378,10 +378,9 @@ impl Repository {
let mut buf = [0u8; 256 * 4];
file.read_exact(&mut buf)?;
for idx in 0..256 {
let offset = idx * 4;
num_objects = u32::from_be_bytes(buf[offset..offset + 4].try_into().unwrap());
fanout_table[idx] = num_objects;
for (idx, fanout_record) in fanout_table.iter_mut().enumerate() {
num_objects = u32::from_be_bytes(buf[idx * 4..idx * 4 + 4].try_into().unwrap());
*fanout_record = num_objects;
}
let mut names = vec![0u8; 20 * num_objects as usize];