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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got patch: diff3 merge for git diffs
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 27 Jun 2022 17:24:31 +0200

Download raw body.

Thread
On Mon, Jun 27, 2022 at 03:01:51PM +0200, Omar Polo wrote:
> > -	if (!got_parse_sha1_digest(id.sha1, blobid))
> > -		return got_error(GOT_ERR_BAD_OBJ_ID_STR);
> > +	if (strlen(blobid) != 40) {
> 
> looking at the length of the blobid to judge if it's abbreviated or not
> is fine?

Yes, but please check against SHA1_DIGEST_STRING_LENGTH - 1 instead of 40.

sha1.h:
#define	SHA1_DIGEST_STRING_LENGTH	(SHA1_DIGEST_LENGTH * 2 + 1)