Merge branch 'jh/verify-index-checksum-only-in-fsck'
The index file has a trailing SHA-1 checksum to detect file corruption, and historically we checked it every time the index file is used. Omit the validation during normal use, and instead verify only in "git fsck". * jh/verify-index-checksum-only-in-fsck: read-cache: force_verify_index_checksum
This commit is contained in:
@ -689,4 +689,17 @@ test_expect_success 'bogus head does not fallback to all heads' '
|
||||
! grep $blob out
|
||||
'
|
||||
|
||||
test_expect_success 'detect corrupt index file in fsck' '
|
||||
cp .git/index .git/index.backup &&
|
||||
test_when_finished "mv .git/index.backup .git/index" &&
|
||||
echo zzzzzzzz >zzzzzzzz &&
|
||||
git add zzzzzzzz &&
|
||||
sed -e "s/zzzzzzzz/yyyyyyyy/" .git/index >.git/index.yyy &&
|
||||
mv .git/index.yyy .git/index &&
|
||||
# Confirm that fsck detects invalid checksum
|
||||
test_must_fail git fsck --cache &&
|
||||
# Confirm that status no longer complains about invalid checksum
|
||||
git status
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user