Sync with 'maint'
[alt-git.git] / t / t1601-index-bogus.sh
blob5dcc10188280b2c0ff4b6b9465c87651de47c5a8
1 #!/bin/sh
3 test_description='test handling of bogus index entries'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'create tree with null sha1' '
9 tree=$(printf "160000 commit $ZERO_OID\\tbroken\\n" | git mktree)
12 test_expect_success 'read-tree refuses to read null sha1' '
13 test_must_fail git read-tree $tree
16 test_expect_success 'GIT_ALLOW_NULL_SHA1 overrides refusal' '
17 GIT_ALLOW_NULL_SHA1=1 git read-tree $tree
20 test_expect_success 'git write-tree refuses to write null sha1' '
21 test_must_fail git write-tree
24 test_done