Re: [PATCH 03/13] delete_ref(): handle special case more explicitly

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

 



On 06/08/2015 06:48 PM, Stefan Beller wrote:
> On Mon, Jun 8, 2015 at 4:45 AM, Michael Haggerty <mhagger@xxxxxxxxxxxx> wrote:
>> delete_ref() uses a different convention for its old_sha1 parameter
>> than, say, ref_transaction_delete(): NULL_SHA1 means not to check the
>> old value. Make this fact a little bit clearer in the code by handling
>> it in explicit, commented code rather than burying it in a conditional
>> expression.
>>
>> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>
>> ---
>>  refs.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/refs.c b/refs.c
>> index b575bb8..f9d87b6 100644
>> --- a/refs.c
>> +++ b/refs.c
>> @@ -2795,10 +2795,13 @@ int delete_ref(const char *refname, const unsigned char *old_sha1,
>>         struct ref_transaction *transaction;
>>         struct strbuf err = STRBUF_INIT;
>>
>> +       /* Treat NULL_SHA1 as "don't care" */
> 
> and by "don't care" you mean we still care about getting it deleted,
> the part we don't care about is the particular sha1 (could be a bogus ref).

Correct. I will to change the comment to

	/*
	 * Treat NULL_SHA1 and NULL alike, to mean "we don't care what
	 * the old value of the reference was (or even if it didn't
	 * exist)":
	 */

to make that clearer.

Michael

-- 
Michael Haggerty
mhagger@xxxxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]