[PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()

2014-10-01 Thread René Scharfe
If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed to happen. This is wrong because the remaining two bytes could still differ. Furthermore: It wouldn't be a

Re: [PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()

2014-10-01 Thread Jeff King
On Wed, Oct 01, 2014 at 11:43:21AM +0200, René Scharfe wrote: If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed to happen. This is wrong because the

Re: [PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()

2014-10-01 Thread René Scharfe
Am 01.10.2014 um 12:50 schrieb Jeff King: On Wed, Oct 01, 2014 at 11:43:21AM +0200, René Scharfe wrote: If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed

Re: [PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()

2014-10-01 Thread Jeff King
On Wed, Oct 01, 2014 at 01:10:12PM +0200, René Scharfe wrote: I wonder if it is worth adding a test (you test only that not found produces a negative index, but not which index). Like: api-sha1-array.txt says about sha1_array_lookup: If not found, returns a negative integer, and that's what

Re: [PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()

2014-10-01 Thread Eric Sunshine
On Wed, Oct 1, 2014 at 5:43 AM, René Scharfe l@web.de wrote: If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed to happen. This is wrong because the