]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5307-pack-missing-commit.sh
Start the 2.46 cycle
[thirdparty/git.git] / t / t5307-pack-missing-commit.sh
CommitLineData
ed62089c
JH
1#!/bin/sh
2
3test_description='pack should notice missing commit objects'
4
d96fb140 5TEST_PASSES_SANITIZE_LEAK=true
ed62089c
JH
6. ./test-lib.sh
7
8test_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" &&
d0fd9931 15 git tag "tag$i" || return 1
ed62089c
JH
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
23test_expect_success 'check corruption' '
24 test_must_fail git fsck
25'
26
27test_expect_success 'rev-list notices corruption (1)' '
31b1de6a 28 test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list HEAD
ed62089c
JH
29'
30
31test_expect_success 'rev-list notices corruption (2)' '
31b1de6a 32 test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list --objects HEAD
ed62089c
JH
33'
34
35test_expect_success 'pack-objects notices corruption' '
36 echo HEAD |
37 test_must_fail git pack-objects --revs pack
38'
39
40test_done