mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
![Junio C Hamano](/assets/img/avatar_default.png)
"git fsck" used to validate only loose objects that are local and nothing else by default. This is not just too little when a repository is borrowing objects from other object stores, but also caused the connectivity check to mistakenly declare loose objects borrowed from them to be missing. The rationale behind the default mode that validates only loose objects is because these objects are still young and more unlikely to have been pushed to other repositories yet. That holds for loose objects borrowed from alternate object stores as well. Signed-off-by: Junio C Hamano <gitster@pobox.com>
32 lines
613 B
Bash
Executable file
32 lines
613 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='git fsck random collection of tests'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
test_commit A fileA one &&
|
|
git checkout HEAD^0 &&
|
|
test_commit B fileB two &&
|
|
git tag -d A B &&
|
|
git reflog expire --expire=now --all
|
|
'
|
|
|
|
test_expect_success 'HEAD is part of refs' '
|
|
test 0 = $(git fsck | wc -l)
|
|
'
|
|
|
|
test_expect_success 'loose objects borrowed from alternate are not missing' '
|
|
mkdir another &&
|
|
(
|
|
cd another &&
|
|
git init &&
|
|
echo ../../../.git/objects >.git/objects/info/alternates &&
|
|
test_commit C fileC one &&
|
|
git fsck >out &&
|
|
! grep "missing blob" out
|
|
)
|
|
'
|
|
|
|
test_done
|