Subject: Re: [PATCH v2 03/16] builtin/update-ref: skip ambiguity checks when parsing object IDs

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 20 Feb 2025 09:05:17 +0100

On Wed, Feb 19, 2025 at 12:21:44PM -0600, Justin Tobler wrote:
> > diff --git a/builtin/update-ref.c b/builtin/update-ref.c
> > index 4d35bdc4b4b..d603f54b770 100644
> > --- a/builtin/update-ref.c
> > +++ b/builtin/update-ref.c
> > @@ -179,7 +179,8 @@ static int parse_next_oid(const char **next, const char *end,
> > @@ -783,7 +786,8 @@ int cmd_update_ref(int argc,
> >  			 * must not already exist:
> >  			 */
> >  			oidclr(&oldoid, the_repository->hash_algo);
> > -		else if (repo_get_oid(the_repository, oldval, &oldoid))
> > +		else if (repo_get_oid_with_flags(the_repository, oldval, &oldoid,
> > +						 GET_OID_SKIP_AMBIGUITY_CHECK))
> >  			die("%s: not a valid old SHA1", oldval);
> >  	}
> 
> In builtin/update-ref.c all uses of repo_get_oid() have been converted
> to repo_get_oid_with_flags() with the GET_OID_SKIP_AMBIGUITY_CHECK flag
> except for one in parse_cmd_symref_update(). Is there reason to leave
> that one untouched?

Ah, no, this was a mere oversight. Good catch, fixed.

Patrick