]> git.ipfire.org Git - thirdparty/git.git/commit - read-cache.c
read-cache: force_verify_index_checksum
authorJeff Hostetler <jeffhost@microsoft.com>
Fri, 14 Apr 2017 20:32:21 +0000 (20:32 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 15 Apr 2017 07:58:36 +0000 (00:58 -0700)
commita33fc72fe911fdb8e284c94e08e8f1dafe4d3187
treecda596575083fbfb2ad1c30ad449926931abe669
parente1104a5ee539408b81566066aaa6963cb87d5cd6
read-cache: force_verify_index_checksum

Teach git to skip verification of the SHA1-1 checksum at the end of
the index file in verify_hdr() which is called from read_index()
unless the "force_verify_index_checksum" global variable is set.

Teach fsck to force this verification.

The checksum verification is for detecting disk corruption, and for
small projects, the time it takes to compute SHA-1 is not that
significant, but for gigantic repositories this calculation adds
significant time to every command.

These effect can be seen using t/perf/p0002-read-cache.sh:

Test                                          HEAD~1            HEAD
--------------------------------------------------------------------------------------
0002.1: read_cache/discard_cache 1000 times   0.66(0.44+0.20)   0.30(0.27+0.02) -54.5%

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c
cache.h
read-cache.c
t/t1450-fsck.sh