3 test_description='git rev-list should notice bad commits'
8 # - compression level is set to zero to make "corruptions" easier to perform
9 # - reflog is disabled to avoid extra references which would twart the test
11 test_expect_success 'setup' \
14 git config core.compression 0 &&
15 git config core.logallrefupdates false &&
18 git commit -m "first commit" &&
21 git commit -m "second commit" &&
24 git commit -m "third commit" &&
25 echo "foo again" >> foo &&
27 git commit -m "fourth commit" &&
31 test_expect_success 'verify number of revisions' \
33 revs=$(git rev-list --all | wc -l) &&
35 first_commit=$(git rev-parse HEAD~3)
38 test_expect_success 'corrupt second commit object' \
40 perl -i.bak -pe "s/second commit/socond commit/" .git/objects/pack/*.pack &&
41 test_must_fail git fsck --full
44 test_expect_success 'rev-list should fail' '
45 test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git rev-list --all > /dev/null
48 test_expect_success 'git repack _MUST_ fail' \
50 test_must_fail git repack -a -f -d
53 test_expect_success 'first commit is still available' \