git/t/t1601-index-bogus.sh
brian m. carlson 8125a58b91 t: switch $_z40 to $ZERO_OID
Switch all uses of $_z40 to $ZERO_OID so that they work correctly with
larger hashes.  This commit was created by using the following sed
command to modify all files in the t directory except t/test-lib.sh:

  sed -i 's/\$_z40/$ZERO_OID/g'

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-14 11:02:00 +09:00

22 lines
522 B
Bash
Executable file

#!/bin/sh
test_description='test handling of bogus index entries'
. ./test-lib.sh
test_expect_success 'create tree with null sha1' '
tree=$(printf "160000 commit $ZERO_OID\\tbroken\\n" | git mktree)
'
test_expect_success 'read-tree refuses to read null sha1' '
test_must_fail git read-tree $tree
'
test_expect_success 'GIT_ALLOW_NULL_SHA1 overrides refusal' '
GIT_ALLOW_NULL_SHA1=1 git read-tree $tree
'
test_expect_success 'git write-tree refuses to write null sha1' '
test_must_fail git write-tree
'
test_done