diff options
author | René Scharfe <l.s.r@web.de> | 2017-08-09 00:07:30 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-09 09:52:25 -0700 |
commit | 6355a768023e7c6d0ec11f2e8cdd2b7501daa516 (patch) | |
tree | 2379e34649e6d5c59c3a353767beff999f2d9ef4 /Documentation/RelNotes/1.7.12.3.txt | |
parent | Git 2.10.3 (diff) | |
download | tgif-6355a768023e7c6d0ec11f2e8cdd2b7501daa516.tar.xz |
sha1_file: avoid comparison if no packed hash matches the first byte
find_pack_entry_one() uses the fan-out table of pack indexes to find out
which entries match the first byte of the searched hash and does a
binary search on this subset of the main index table.
If there are no matching entries then lo and hi will have the same
value. The binary search still starts and compares the hash of the
following entry (which has a non-matching first byte, so won't cause any
trouble), or whatever comes after the sorted list of entries.
The probability of that stray comparison matching by mistake is low, but
let's not take any chances and check when entering the binary search
loop if we're actually done already.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/RelNotes/1.7.12.3.txt')
0 files changed, 0 insertions, 0 deletions