git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Jun 3, 2015, 09:09 UTC
Message-ID
<20150603090903.GE32000@peff.net>
In-Reply-To
<556E1BBE.7000708@alum.mit.edu>
On Tue, Jun 02, 2015 at 11:10:22PM +0200, Michael Haggerty wrote:
Show 8 quoted lines
> >> +
> >> +                       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
> think I can make this go away and make the code clearer in general by
> restructuring the logic a little bit. I will do that in the next round.
If you get rid of the useless hashclr(), then this just becomes:
  if (!(flag & REF_ISBROKEN) && is_null_sha1(sha1))
	flag |= REF_ISBROKEN;

The reason for the initial check seems pretty obvious then (but it would also be OK without it; is_null_sha1 is not that expensive).

-Peff
Previous: Michael HaggertyNext: Junio C Hamano
Message 7 of 8 in “Fix how for-each-ref handles broken loose references”
  1. 0/3 Fix how for-each-ref handles broken loose referencesMichael Haggerty, Jun 2, 2015
  2. 1/3 t6301: new tests of for-each-ref error handlingMichael Haggerty, Jun 2, 2015
  3. 2/3 for-each-ref: report broken references correctlyMichael Haggerty, Jun 2, 2015
  4. 3/3 read_loose_refs(): treat NULL_SHA1 loose references as brokenMichael Haggerty, Jun 2, 2015
  5. Stefan BellerJun 2, 2015
  6. Michael HaggertyJun 2, 2015
  7. Jeff KingJun 3, 2015
  8. Junio C HamanoJun 2, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.