t/t3*: avoid redundant uses of cat
[alt-git.git] / t / t5307-pack-missing-commit.sh
blob1e02c305c4fe5f910935463bbbb6724a3bde212d
1 #!/bin/sh
3 test_description='pack should notice missing commit objects'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
9 for i in 1 2 3 4 5
11 echo "$i" >"file$i" &&
12 git add "file$i" &&
13 test_tick &&
14 git commit -m "$i" &&
15 git tag "tag$i" || return 1
16 done &&
17 obj=$(git rev-parse --verify tag3) &&
18 fanout=$(expr "$obj" : "\(..\)") &&
19 remainder=$(expr "$obj" : "..\(.*\)") &&
20 rm -f ".git/objects/$fanout/$remainder"
23 test_expect_success 'check corruption' '
24 test_must_fail git fsck
27 test_expect_success 'rev-list notices corruption (1)' '
28 test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list HEAD
31 test_expect_success 'rev-list notices corruption (2)' '
32 test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list --objects HEAD
35 test_expect_success 'pack-objects notices corruption' '
36 echo HEAD |
37 test_must_fail git pack-objects --revs pack
40 test_done