| @@ -29,7 +29,7 @@ mod error { · 28 unmodified lines |
| 29 | 29 | #[error("The multi-pack fan doesn't have the correct size of 256 * 4 bytes")] |
| 30 | 30 | MultiPackFanSize, |
| 31 | 31 | #[error(transparent)] |
| 32 | | − PackNames(#[from] chunk::pack_names::from_slice::Error), |
| 32 | + PackNames(#[from] chunk::index_names::from_slice::Error), |
| 33 | 33 | #[error("The chunk with alphabetically ordered object ids doesn't have the correct size")] |
| 34 | 34 | OidLookupSize, |
| 35 | 35 | #[error("The chunk with offsets into the pack doesn't have the correct size")] |
| @@ -100,22 +100,23 @@ impl TryFrom<&Path> for File { · 64 unmodified lines |
| 100 | 100 | }; |
| 101 | 101 | |
| 102 | 102 | let chunks = git_chunk::file::Index::from_bytes(&data, HEADER_LEN, num_chunks as u32)?; |
| 103 | | − let pack_names = chunks.data_by_kind(&data, chunk::pack_names::ID)?; |
| 104 | | − let index_names = chunk::pack_names::from_slice(pack_names, num_packs)?; |
| 105 | 103 | |
| 106 | | − let fan = chunks.data_by_kind(&data, chunk::fanout::ID)?; |
| 104 | + let index_names = chunks.data_by_id(&data, chunk::index_names::ID)?; |
| 105 | + let index_names = chunk::index_names::from_slice(index_names, num_packs)?; |
| 106 | + |
| 107 | + let fan = chunks.data_by_id(&data, chunk::fanout::ID)?; |
| 107 | 108 | let fan = chunk::fanout::from_slice(fan).ok_or(Error::MultiPackFanSize)?; |
| 108 | 109 | let num_objects = fan[255]; |
| 109 | 110 | |
| 110 | | − let lookup = chunks.offset_by_kind(chunk::lookup::ID)?; |
| 111 | + let lookup = chunks.offset_by_id(chunk::lookup::ID)?; |
| 111 | 112 | if !chunk::lookup::is_valid(&lookup, hash_kind, num_objects) { |
| 112 | 113 | return Err(Error::OidLookupSize); |
| 113 | 114 | } |
| 114 | | − let offsets = chunks.offset_by_kind(chunk::offsets::ID)?; |
| 115 | + let offsets = chunks.offset_by_id(chunk::offsets::ID)?; |
| 115 | 116 | if !chunk::offsets::is_valid(&offsets, num_objects) { |
| 116 | 117 | return Err(Error::OffsetsSize); |
| 117 | 118 | } |
| 118 | | − let large_offsets = chunks.offset_by_kind(chunk::large_offsets::ID).ok(); |
| 119 | + let large_offsets = chunks.offset_by_id(chunk::large_offsets::ID).ok(); |
| 119 | 120 | if !chunk::large_offsets::is_valid(large_offsets.as_ref()) { |
| 120 | 121 | return Err(Error::LargeOffsetsSize); |
| 121 | 122 | } |