3 test_description
='git rev-list should notice bad commits'
5 TEST_PASSES_SANITIZE_LEAK
=true
9 # - compression level is set to zero to make "corruptions" easier to perform
10 # - reflog is disabled to avoid extra references which would twart the test
12 test_expect_success
'setup' \
15 git config core.compression 0 &&
16 git config core.logallrefupdates false &&
19 git commit -m "first commit" &&
22 git commit -m "second commit" &&
25 git commit -m "third commit" &&
26 echo "foo again" >> foo &&
28 git commit -m "fourth commit" &&
32 test_expect_success
'verify number of revisions' \
34 revs=$(git rev-list --all | wc -l) &&
36 first_commit=$(git rev-parse HEAD~3)
39 test_expect_success
'corrupt second commit object' \
41 perl -i.bak -pe "s/second commit/socond commit/" .git/objects/pack/*.pack &&
42 test_must_fail git fsck --full
45 test_expect_success
'rev-list should fail' '
46 test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list --all > /dev/null
49 test_expect_success
'git repack _MUST_ fail' \
51 test_must_fail git repack -a -f -d
54 test_expect_success
'first commit is still available' \