| @@ -92,7 +92,7 @@ impl TryFrom<&Path> for File { · 91 unmodified lines |
| 92 | 92 | }; |
| 93 | 93 | ofs += 1; |
| 94 | 94 | |
| 95 | | − let hash_kind = match data[ofs] { |
| 95 | + let object_hash = match data[ofs] { |
| 96 | 96 | 1 => git_hash::Kind::Sha1, |
| 97 | 97 | x => { |
| 98 | 98 | return Err(Error::UnsupportedHashVersion(x)); |
| @@ -113,17 +113,17 @@ impl TryFrom<&Path> for File { · 14 unmodified lines |
| 113 | 113 | let base_graphs_list_offset = chunks |
| 114 | 114 | .validated_usize_offset_by_id(BASE_GRAPHS_LIST_CHUNK_ID, |chunk_range| { |
| 115 | 115 | let chunk_size = chunk_range.len(); |
| 116 | | − if chunk_size % hash_kind.len_in_bytes() != 0 { |
| 116 | + if chunk_size % object_hash.len_in_bytes() != 0 { |
| 117 | 117 | return Err(Error::InvalidChunkSize { |
| 118 | 118 | id: BASE_GRAPHS_LIST_CHUNK_ID, |
| 119 | 119 | msg: format!( |
| 120 | 120 | "chunk size {} is not a multiple of {}", |
| 121 | 121 | chunk_size, |
| 122 | | − hash_kind.len_in_bytes() |
| 122 | + object_hash.len_in_bytes() |
| 123 | 123 | ), |
| 124 | 124 | }); |
| 125 | 125 | } |
| 126 | | − let chunk_base_graph_count: u32 = (chunk_size / hash_kind.len_in_bytes()) |
| 126 | + let chunk_base_graph_count: u32 = (chunk_size / object_hash.len_in_bytes()) |
| 127 | 127 | .try_into() |
| 128 | 128 | .expect("base graph count to fit in 32-bits"); |
| 129 | 129 | if chunk_base_graph_count != u32::from(base_graph_count) { |
| @@ -141,7 +141,7 @@ impl TryFrom<&Path> for File { · 11 unmodified lines |
| 141 | 141 | chunks.validated_usize_offset_by_id(COMMIT_DATA_CHUNK_ID, |chunk_range| { |
| 142 | 142 | let chunk_size = chunk_range.len(); |
| 143 | 143 | |
| 144 | | − let entry_size = hash_kind.len_in_bytes() + COMMIT_DATA_ENTRY_SIZE_SANS_HASH; |
| 144 | + let entry_size = object_hash.len_in_bytes() + COMMIT_DATA_ENTRY_SIZE_SANS_HASH; |
| 145 | 145 | if chunk_size % entry_size != 0 { |
| 146 | 146 | return Err(Error::InvalidChunkSize { |
| 147 | 147 | id: COMMIT_DATA_CHUNK_ID, |
| @@ -173,19 +173,19 @@ impl TryFrom<&Path> for File { · 25 unmodified lines |
| 173 | 173 | chunks.validated_usize_offset_by_id(OID_LOOKUP_CHUNK_ID, |chunk_range| { |
| 174 | 174 | let chunk_size = chunk_range.len(); |
| 175 | 175 | |
| 176 | | − if chunk_size % hash_kind.len_in_bytes() != 0 { |
| 176 | + if chunk_size % object_hash.len_in_bytes() != 0 { |
| 177 | 177 | return Err(Error::InvalidChunkSize { |
| 178 | 178 | id: OID_LOOKUP_CHUNK_ID, |
| 179 | 179 | msg: format!( |
| 180 | 180 | "chunk size {} is not a multiple of {}", |
| 181 | 181 | chunk_size, |
| 182 | | − hash_kind.len_in_bytes() |
| 182 | + object_hash.len_in_bytes() |
| 183 | 183 | ), |
| 184 | 184 | }); |
| 185 | 185 | } |
| 186 | 186 | Ok(( |
| 187 | 187 | chunk_range.start, |
| 188 | | − (chunk_size / hash_kind.len_in_bytes()) |
| 188 | + (chunk_size / object_hash.len_in_bytes()) |
| 189 | 189 | .try_into() |
| 190 | 190 | .expect("number of commits in OIDL chunk to fit in 32 bits"), |
| 191 | 191 | )) |
| @@ -194,10 +194,10 @@ impl TryFrom<&Path> for File { · 2 unmodified lines |
| 194 | 194 | let extra_edges_list_range = chunks.usize_offset_by_id(EXTENDED_EDGES_LIST_CHUNK_ID).ok(); |
| 195 | 195 | |
| 196 | 196 | let trailer = &data[chunks.highest_offset() as usize..]; |
| 197 | | − if trailer.len() != hash_kind.len_in_bytes() { |
| 197 | + if trailer.len() != object_hash.len_in_bytes() { |
| 198 | 198 | return Err(Error::Trailer(format!( |
| 199 | 199 | "Expected commit-graph trailer to contain {} bytes, got {}", |
| 200 | | − hash_kind.len_in_bytes(), |
| 200 | + object_hash.len_in_bytes(), |
| 201 | 201 | trailer.len() |
| 202 | 202 | ))); |
| 203 | 203 | } |
| @@ -235,7 +235,8 @@ impl TryFrom<&Path> for File { · 31 unmodified lines |
| 235 | 235 | fan, |
| 236 | 236 | oid_lookup_offset, |
| 237 | 237 | path: path.to_owned(), |
| 238 | | − hash_len: hash_kind.len_in_bytes(), |
| 238 | + hash_len: object_hash.len_in_bytes(), |
| 239 | + object_hash, |
| 239 | 240 | }) |
| 240 | 241 | } |
| 241 | 242 | } |