X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=t%2Ft1450-fsck.sh;h=759cf12e16bcddc3dab9d6b3ad8abd5590245a94;hb=452c6d506b1a6dcf24d4ceaa592afc39c1c1a60e;hp=a22632f483e2068642aa09a5bc28fde01d2294b9;hpb=1d7d6ad539fabd49421d8ef7b27c0f287430bc7d;p=git.git diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index a22632f48..759cf12e1 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -5,7 +5,9 @@ test_description='git fsck random collection of tests' . ./test-lib.sh test_expect_success setup ' + git config i18n.commitencoding ISO-8859-1 && test_commit A fileA one && + git config --unset i18n.commitencoding && git checkout HEAD^0 && test_commit B fileB two && git tag -d A B && @@ -28,6 +30,12 @@ test_expect_success 'loose objects borrowed from alternate are not missing' ' ) ' +test_expect_success 'valid objects appear valid' ' + { git fsck 2>out; true; } && + ! grep error out && + ! grep fatal out +' + # Corruption tests follow. Make sure to remove all traces of the # specific corruption you test afterwards, lest a later test trip over # it. @@ -57,6 +65,34 @@ test_expect_success 'branch pointing to non-commit' ' git update-ref -d refs/heads/invalid ' +new=nothing +test_expect_success 'email without @ is okay' ' + git cat-file commit HEAD >basis && + sed "s/@/AT/" basis >okay && + new=$(git hash-object -t commit -w --stdin out && + cat out && + ! grep "error in commit $new" out +' +git update-ref -d refs/heads/bogus +rm -f ".git/objects/$new" + +new=nothing +test_expect_success 'email with embedded > is not okay' ' + git cat-file commit HEAD >basis && + sed "s/@[a-z]/&>/" basis >bad-email && + new=$(git hash-object -t commit -w --stdin out && + cat out && + grep "error in commit $new" out +' +git update-ref -d refs/heads/bogus +rm -f ".git/objects/$new" + cat > invalid-tag < 1234567890 -0000 This is an invalid tag. EOF -test_expect_failure 'tag pointing to nonexistent' ' - tag=$(git hash-object -w --stdin < invalid-tag) && +test_expect_success 'tag pointing to nonexistent' ' + tag=$(git hash-object -t tag -w --stdin < invalid-tag) && echo $tag > .git/refs/tags/invalid && - git fsck --tags 2>out && + test_must_fail git fsck --tags >out && cat out && - grep "could not load tagged object" out && + grep "broken link" out && rm .git/refs/tags/invalid ' @@ -84,12 +120,12 @@ tagger T A Gger 1234567890 -0000 This is an invalid tag. EOF -test_expect_failure 'tag pointing to something else than its type' ' - tag=$(git hash-object -w --stdin < wrong-tag) && +test_expect_success 'tag pointing to something else than its type' ' + tag=$(git hash-object -t tag -w --stdin < wrong-tag) && echo $tag > .git/refs/tags/wrong && - git fsck --tags 2>out && + test_must_fail git fsck --tags 2>out && cat out && - grep "some sane error message" out && + grep "error in tag.*broken links" out && rm .git/refs/tags/wrong '