Re: [PATCH 3/6] object-name: make get_oid quietly return an error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-03-16 at 16:56:22, Junio C Hamano wrote:
> > diff --git a/object-name.c b/object-name.c
> > index 92862eeb1a..daa3ef77ef 100644
> > --- a/object-name.c
> > +++ b/object-name.c
> > @@ -911,13 +911,17 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
> >  						len, str,
> >  						show_date(co_time, co_tz, DATE_MODE(RFC2822)));
> >  				}
> > -			} else {
> > +			} else if (!(flags & GET_OID_RETURN_FAILURE)) {
> >  				if (flags & GET_OID_QUIETLY) {
> >  					exit(128);
> >  				}
> >  				die(_("log for '%.*s' only has %d entries"),
> >  				    len, str, co_cnt);
> >  			}
> > +			if (flags & GET_OID_RETURN_FAILURE) {
> > +				free(real_ref);
> > +				return -1;
> > +			}
> >  		}
> 
> So, without the new bit, we used to die loudly or quietly.  The new
> bit allows us to return an error to the caller without dying
> ourselves.
> 
> You can call the bit _RETURN_ERROR and not to worry about the
> right-alignment above ;-), but better yet, how about calling it
> _GENTLY, which is how we call such a variant of behaviour?

Sure, that works.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux