Merge branch 'rs/find-pack-entry-bisection' into next
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Aug 2017 20:52:58 +0000 (13:52 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Aug 2017 20:52:58 +0000 (13:52 -0700)
Code clean-up.

* rs/find-pack-entry-bisection:
sha1_file: avoid comparison if no packed hash matches the first byte

1  2 
sha1_file.c
diff --cc sha1_file.c
index ccf6fcf4ecafb50347747ed8dce5f09157a65ad8,3047ee04f1ba50967836ba318a0b96e96d5962b4..607b34ea53609a4d34e90fabc97dfef2fc6c3d05
@@@ -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);