"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: use SHA1_DIGEST_LENGTH instead of sizeof(id)
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 18 Feb 2023 12:39:39 +0100

Download raw body.

Thread
On Sat, Feb 18, 2023 at 12:29:17PM +0100, Omar Polo wrote:
> Since it's used to find the offset in the mmap'ed area it should rely
> on the size of the digest, not the size of our struct (which just
> happens to be the same as of now ;-)
> 
> ok?

Yes, ok. In the future this size may have to be adjusted based on
object ID type I guess.

> diff /home/op/w/gotd
> commit - bf1c78e5100932aa445b8ef07ebf9b712500c67e
> path + /home/op/w/gotd
> blob - 68de5bf9f8523cf07c88e05955ce9b4c6abc451a
> file + lib/pack.c
> --- lib/pack.c
> +++ lib/pack.c
> @@ -1143,7 +1143,7 @@ resolve_ref_delta(struct got_delta_chain *deltas, stru
>  	if (err)
>  		return err;
>  	if (pack->map) {
> -		delta_data_offset = delta_offset + tslen + sizeof(id);
> +		delta_data_offset = delta_offset + tslen + SHA1_DIGEST_LENGTH;
>  	} else {
>  		delta_data_offset = lseek(pack->fd, 0, SEEK_CUR);
>  		if (delta_data_offset == -1)
> 
>