All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: Stefan Beller <sbeller@google.com>,
	Junio C Hamano <gitster@pobox.com>,
	Anders Kaseorg <andersk@mit.edu>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken
Date: Wed, 3 Jun 2015 05:09:03 -0400	[thread overview]
Message-ID: <20150603090903.GE32000@peff.net> (raw)
In-Reply-To: <556E1BBE.7000708@alum.mit.edu>

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

  reply	other threads:[~2015-06-03  9:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 15:57 [PATCH v2 0/3] Fix how for-each-ref handles broken loose references Michael Haggerty
2015-06-02 15:57 ` [PATCH v2 1/3] t6301: new tests of for-each-ref error handling Michael Haggerty
2015-06-02 15:57 ` [PATCH v2 2/3] for-each-ref: report broken references correctly Michael Haggerty
2015-06-02 15:57 ` [PATCH v2 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken Michael Haggerty
2015-06-02 17:28   ` Stefan Beller
2015-06-02 21:10     ` Michael Haggerty
2015-06-03  9:09       ` Jeff King [this message]
2015-06-02 20:11   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150603090903.GE32000@peff.net \
    --to=peff@peff.net \
    --cc=andersk@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.