Re: [PATCH v2 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken

2015-06-03 Thread Jeff King
On Tue, Jun 02, 2015 at 11:10:22PM +0200, Michael Haggerty wrote: > >> + > >> + if (!(flag & REF_ISBROKEN) && is_null_sha1(sha1)) { > > > > Why do we do the extra check for !(flag & REF_ISBROKEN) here? > > That was an attempt to avoid calling is_null_sha1() unnecessarily. I

Re: [PATCH v2 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken

2015-06-02 Thread Michael Haggerty
On 06/02/2015 07:28 PM, Stefan Beller wrote: > On Tue, Jun 2, 2015 at 8:57 AM, Michael Haggerty wrote: >> NULL_SHA1 is never a valid value for a reference. If a loose reference >> has that value, mark it as broken. >> >> Why check NULL_SHA1 and not the nearly 2^160 other SHA-1s that are >> also in

Re: [PATCH v2 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken

2015-06-02 Thread Junio C Hamano
Michael Haggerty writes: > NULL_SHA1 is never a valid value for a reference. If a loose reference > has that value, mark it as broken. > > Why check NULL_SHA1 and not the nearly 2^160 other SHA-1s that are > also invalid in a given repository? Because (a) it is cheap to test > for NULL_SHA1, and

Re: [PATCH v2 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken

2015-06-02 Thread Stefan Beller
On Tue, Jun 2, 2015 at 8:57 AM, Michael Haggerty wrote: > NULL_SHA1 is never a valid value for a reference. If a loose reference > has that value, mark it as broken. > > Why check NULL_SHA1 and not the nearly 2^160 other SHA-1s that are > also invalid in a given repository? Because (a) it is cheap

[PATCH v2 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken

2015-06-02 Thread Michael Haggerty
NULL_SHA1 is never a valid value for a reference. If a loose reference has that value, mark it as broken. Why check NULL_SHA1 and not the nearly 2^160 other SHA-1s that are also invalid in a given repository? Because (a) it is cheap to test for NULL_SHA1, and (b) NULL_SHA1 is often used as a "SHA-