git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "René Scharfe" <l.s.r@web.de>, "Git List" <git@vger.kernel.org>,
	"Jonathan Tan" <jonathantanmy@google.com>
Subject: Re: [PATCH] sha1_file: avoid comparison if no packed hash matches the first byte
Date: Tue, 8 Aug 2017 18:58:51 -0400	[thread overview]
Message-ID: <20170808225851.kgbyrlqrtlurzc73@sigill.intra.peff.net> (raw)
In-Reply-To: <20170808225231.3l7gyoxxvghsvtv7@sigill.intra.peff.net>

On Tue, Aug 08, 2017 at 06:52:31PM -0400, Jeff King wrote:

> > Interesting.  I see that we still have the conditional code to call
> > out to sha1-lookup.c::sha1_entry_pos().  Do we need a similar change
> > over there, I wonder?  Alternatively, as we have had the experimental
> > sha1-lookup.c::sha1_entry_pos() long enough without anybody using it,
> > perhaps we should write it off as a failed experiment and retire it?
> 
> There is also sha1_pos(), which seems to have the same problem (and is
> used in several places).

Actually, I take it back. The problem happens when we enter the loop
with no entries to look at. But both sha1_pos() and sha1_entry_pos()
return early before hitting their do-while loops in that case.

-Peff

  reply	other threads:[~2017-08-08 22:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 22:07 [PATCH] sha1_file: avoid comparison if no packed hash matches the first byte René Scharfe
2017-08-08 22:41 ` Jonathan Nieder
2017-08-08 22:43 ` Junio C Hamano
2017-08-08 22:52   ` Jeff King
2017-08-08 22:58     ` Jeff King [this message]
2017-08-09  5:36       ` Junio C Hamano
2017-08-09  9:20         ` Jeff King
2017-08-09 10:11           ` Jeff King
2017-08-09 10:14             ` [PATCH 1/2] sha1_file: drop experimental GIT_USE_LOOKUP search Jeff King
2017-08-09 18:12               ` Junio C Hamano
2017-08-09 21:09                 ` Jeff King
2017-08-09 10:16             ` [PATCH 2/2] hashcmp: use memcmp instead of open-coded loop Jeff King
2017-08-09 14:55               ` René Scharfe
2017-08-09 15:06                 ` Jeff King

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=20170808225851.kgbyrlqrtlurzc73@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    --cc=l.s.r@web.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).