]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5307-pack-missing-commit.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t5307-pack-missing-commit.sh
1 #!/bin/sh
2
3 test_description='pack should notice missing commit objects'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success setup '
9 for i in 1 2 3 4 5
10 do
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"
21 '
22
23 test_expect_success 'check corruption' '
24 test_must_fail git fsck
25 '
26
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
29 '
30
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
33 '
34
35 test_expect_success 'pack-objects notices corruption' '
36 echo HEAD |
37 test_must_fail git pack-objects --revs pack
38 '
39
40 test_done