Commit Diff


commit - 14bbe0dc3793eb4b72d27759bd83602c2c04d54d
commit + 4108f1e9549ca6bec0a5f36e0573dc0319f9880d
blob - 74715d03c7a47ec8612b69c2d492e47ffa86062e
blob + 20ad907906f81fc5442c688832a4e06b05beee55
--- lib/pack.c
+++ lib/pack.c
@@ -1146,7 +1146,8 @@ resolve_ref_delta(struct got_delta_chain *deltas, stru
 	if (err)
 		return err;
 	if (pack->map) {
-		delta_data_offset = delta_offset + tslen + SHA1_DIGEST_LENGTH;
+		delta_data_offset = delta_offset + tslen +
+		    got_hash_digest_length(packidx->algo);
 	} else {
 		delta_data_offset = lseek(pack->fd, 0, SEEK_CUR);
 		if (delta_data_offset == -1)
@@ -2089,7 +2090,7 @@ got_packfile_extract_raw_delta(uint8_t **delta_buf, si
 		err = got_pack_parse_ref_delta(base_id, pack, offset, tslen);
 		if (err)
 			return err;
-		delta_hdrlen = SHA1_DIGEST_LENGTH;
+		delta_hdrlen = got_hash_digest_length(pack->algo);
 		break;
 	default:
 		return got_error_fmt(GOT_ERR_OBJ_TYPE,