summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-10 17:03:02 +0900
committerJunio C Hamano <gitster@pobox.com>2017-09-10 17:03:02 +0900
commitc580ce194fc1a62b676190a3300fde4c6ba58380 (patch)
tree87c83a18018316bc02d84b38bb4d660a74d99fc1
parentc7759cd60ab0213024c3fbe9a163dcd49b2bb838 (diff)
parent6355a768023e7c6d0ec11f2e8cdd2b7501daa516 (diff)
downloadgit-c580ce194fc1a62b676190a3300fde4c6ba58380.tar.gz
Merge branch 'rs/find-pack-entry-bisection' into maint
Code clean-up. * rs/find-pack-entry-bisection: sha1_file: avoid comparison if no packed hash matches the first byte
-rw-r--r--sha1_file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index b7bb38b445..4c4a1f1ea3 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2800,7 +2800,7 @@ off_t find_pack_entry_one(const unsigned char *sha1,
return nth_packed_object_offset(p, pos);
}
- do {
+ while (lo < hi) {
unsigned mi = (lo + hi) / 2;
int cmp = hashcmp(index + mi * stride, sha1);
@@ -2813,7 +2813,7 @@ off_t find_pack_entry_one(const unsigned char *sha1,
hi = mi;
else
lo = mi+1;
- } while (lo < hi);
+ }
return 0;
}