blob: 4171f1e14103135ef3e47a3b3df19d5a285b4a8a [file] [log] [blame]
Jeff Kinga96d3cc2017-04-21 14:46:17 -04001#!/bin/sh
2
3test_description='test handling of bogus index entries'
4. ./test-lib.sh
5
6test_expect_success 'create tree with null sha1' '
brian m. carlson8125a582018-05-13 02:24:13 +00007 tree=$(printf "160000 commit $ZERO_OID\\tbroken\\n" | git mktree)
Jeff Kinga96d3cc2017-04-21 14:46:17 -04008'
9
10test_expect_success 'read-tree refuses to read null sha1' '
11 test_must_fail git read-tree $tree
12'
13
14test_expect_success 'GIT_ALLOW_NULL_SHA1 overrides refusal' '
15 GIT_ALLOW_NULL_SHA1=1 git read-tree $tree
16'
17
18test_expect_success 'git write-tree refuses to write null sha1' '
19 test_must_fail git write-tree
20'
21
22test_done