From: Junio C Hamano Date: Tue, 22 Aug 2017 17:29:11 +0000 (-0700) Subject: Merge branch 'rs/find-pack-entry-bisection' X-Git-Tag: v2.15.0-rc0~164 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3717f91c5a1afd45b15e255d6dc38431b020f8bf;p=thirdparty%2Fgit.git Merge branch 'rs/find-pack-entry-bisection' Code clean-up. * rs/find-pack-entry-bisection: sha1_file: avoid comparison if no packed hash matches the first byte --- 3717f91c5a1afd45b15e255d6dc38431b020f8bf diff --cc sha1_file.c index ccf6fcf4ec,3047ee04f1..607b34ea53 --- a/sha1_file.c +++ b/sha1_file.c @@@ -2788,7 -2516,17 +2788,7 @@@ off_t find_pack_entry_one(const unsigne printf("%02x%02x%02x... lo %u hi %u nr %"PRIu32"\n", sha1[0], sha1[1], sha1[2], lo, hi, p->num_objects); - do { - if (use_lookup < 0) - use_lookup = !!getenv("GIT_USE_LOOKUP"); - if (use_lookup) { - int pos = sha1_entry_pos(index, stride, 0, - lo, hi, p->num_objects, sha1); - if (pos < 0) - return 0; - return nth_packed_object_offset(p, pos); - } - + while (lo < hi) { unsigned mi = (lo + hi) / 2; int cmp = hashcmp(index + mi * stride, sha1);