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

Re: [PATCH] sha1_file: avoid comparison if no packed hash matches the first byte

From
Jeff King <peff@peff.net>
Date
Aug 8, 2017, 22:52 UTC
Message-ID
<20170808225231.3l7gyoxxvghsvtv7@sigill.intra.peff.net>
In-Reply-To
<xmqq3791adfi.fsf@gitster.mtv.corp.google.com>
On Tue, Aug 08, 2017 at 03:43:13PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> > @@ -2812,7 +2812,7 @@ off_t find_pack_entry_one(const unsigned char *sha1,
> >  			hi = mi;
> >  		else
> >  			lo = mi+1;
> > -	} while (lo < hi);
> > +	}
> >  	return 0;
> >  }
> 
> 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).

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 4 of 14 in “sha1_file: avoid comparison if no packed hash matches the first byte”
  1. sha1_file: avoid comparison if no packed hash matches the first byteRené Scharfe, Aug 8, 2017
  2. Jonathan NiederAug 8, 2017
  3. Junio C HamanoAug 8, 2017
  4. Jeff KingAug 8, 2017
  5. Jeff KingAug 8, 2017
  6. Junio C HamanoAug 9, 2017
  7. Jeff KingAug 9, 2017
  8. Jeff KingAug 9, 2017
  9. 1/2 sha1_file: drop experimental GIT_USE_LOOKUP searchJeff King, Aug 9, 2017
  10. Junio C HamanoAug 9, 2017
  11. Jeff KingAug 9, 2017
  12. 2/2 hashcmp: use memcmp instead of open-coded loopJeff King, Aug 9, 2017
  13. René ScharfeAug 9, 2017
  14. Jeff KingAug 9, 2017

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.