| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='test handling of bogus index entries' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success 'create tree with null sha1' ' |
| 8 | tree=$(printf "160000 commit $ZERO_OID\\tbroken\\n" | git mktree) |
| 9 | ' |
| 10 | |
| 11 | test_expect_success 'read-tree refuses to read null sha1' ' |
| 12 | test_must_fail git read-tree $tree |
| 13 | ' |
| 14 | |
| 15 | test_expect_success 'GIT_ALLOW_NULL_SHA1 overrides refusal' ' |
| 16 | GIT_ALLOW_NULL_SHA1=1 git read-tree $tree |
| 17 | ' |
| 18 | |
| 19 | test_expect_success 'git write-tree refuses to write null sha1' ' |
| 20 | test_must_fail git write-tree |
| 21 | ' |
| 22 | |
| 23 | test_done |