Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'rs/find-pack-entry-bisection'
author
Junio C Hamano
<gitster@pobox.com>
Tue, 22 Aug 2017 17:29:11 +0000
(10:29 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 22 Aug 2017 17:29:12 +0000
(10:29 -0700)
Code clean-up.
* rs/find-pack-entry-bisection:
sha1_file: avoid comparison if no packed hash matches the first byte
sha1_file.c
patch
|
blob
|
history
raw
(from parent 1:
1168df9
)
diff --git
a/sha1_file.c
b/sha1_file.c
index ccf6fcf4ecafb50347747ed8dce5f09157a65ad8..607b34ea53609a4d34e90fabc97dfef2fc6c3d05 100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-2788,7
+2788,7
@@
off_t find_pack_entry_one(const unsigned char *sha1,
printf("%02x%02x%02x... lo %u hi %u nr %"PRIu32"\n",
sha1[0], sha1[1], sha1[2], lo, hi, p->num_objects);
-
do
{
+
while (lo < hi)
{
unsigned mi = (lo + hi) / 2;
int cmp = hashcmp(index + mi * stride, sha1);
@@
-2801,7
+2801,7
@@
off_t find_pack_entry_one(const unsigned char *sha1,
hi = mi;
else
lo = mi+1;
- }
while (lo < hi);
+ }
return 0;
}