Skip to content

Commit 3717f91

Browse files
committed
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
2 parents 1168df9 + 6355a76 commit 3717f91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sha1_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,7 @@ off_t find_pack_entry_one(const unsigned char *sha1,
27882788
printf("%02x%02x%02x... lo %u hi %u nr %"PRIu32"\n",
27892789
sha1[0], sha1[1], sha1[2], lo, hi, p->num_objects);
27902790

2791-
do {
2791+
while (lo < hi) {
27922792
unsigned mi = (lo + hi) / 2;
27932793
int cmp = hashcmp(index + mi * stride, sha1);
27942794

@@ -2801,7 +2801,7 @@ off_t find_pack_entry_one(const unsigned char *sha1,
28012801
hi = mi;
28022802
else
28032803
lo = mi+1;
2804-
} while (lo < hi);
2804+
}
28052805
return 0;
28062806
}
28072807

0 commit comments

Comments
 (0)