Subject: Re: [PATCH v6 4/6] transaction: add TRANSACTION_CREATE_EXISTS error

From: Junio C Hamano <[email-masked]>
Date: Fri, 11 Oct 2024 09:34:04 -0700

karthik nayak <[email-masked]> writes:

>> +			} else {
>> +				int checkret;
>> +				checkret = check_old_oid(update, &lock->old_oid, err);
>> +				if  (checkret) {
>> +					ret = checkret;
>> +					goto out;
>> +				}
>
> Can't we simply do:
>
>   ret = check_old_oid(update, &lock->old_oid, err);
>   if (ret) {
>      goto out
>   }
>
> if ret is '0', it shouldn't matter no?

That's nice.  Yes, as long as "ret" has no useful information when
we enter this "else" block, reusing it like you did is just fine.

This is one of these moments I tell myself "oh, why didn't *I* think
of that" ;-).

Thanks.