Re: [PATCH v3 19/19] delete_ref(): use the usual convention for old_sha1
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 22, 2015, 21:10 UTC
- Message-ID
- <xmqqpp4nfo0f.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <29ca4c18c045147c5260eb699dad31d0e4036e8b.1434980615.git.mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 17 quoted lines
> The ref_transaction_update() family of functions use the following > convention for their old_sha1 parameters: > > * old_sha1 == NULL: Don't check the old value at all. > * is_null_sha1(old_sha1): Ensure that the reference didn't exist > before the transaction. > * otherwise: Ensure that the reference had the specified value before > the transaction. > > delete_ref() had a different convention, namely treating > is_null_sha1(old_sha1) as "don't care". Change it to adhere to the > standard convention to reduce the scope for confusion. > > Please note that it is now a bug to pass old_sha1=NULL_SHA1 to > delete_ref() (because it doesn't make sense to delete a reference that > you already know doesn't exist). This is consistent with the behavior > of ref_transaction_delete().
Nice.
Everything I read in this round of changes makes sense (except for the ones I had minor comments on, which were separately sent).
Thanks.