From: Junio C Hamano Date: Fri, 18 Aug 2017 20:52:58 +0000 (-0700) Subject: Merge branch 'rs/find-pack-entry-bisection' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b4130177a9744b947c400d7d59c091c057e0cf2f?hp=--cc Merge branch 'rs/find-pack-entry-bisection' into next Code clean-up. * rs/find-pack-entry-bisection: sha1_file: avoid comparison if no packed hash matches the first byte --- b4130177a9744b947c400d7d59c091c057e0cf2f 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);