git/t/t3103-ls-tree-misc.sh
brian m. carlson 831c61cc6b t3103: abstract away SHA-1-specific constants
Adjust the test so that it uses variables and command substitution for
trees instead of hard-coded hashes.  This also has the benefit of making
it more obvious how the test works.

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

25 lines
466 B
Bash
Executable file

#!/bin/sh
test_description='
Miscellaneous tests for git ls-tree.
1. git ls-tree fails in presence of tree damage.
'
. ./test-lib.sh
test_expect_success 'setup' '
mkdir a &&
touch a/one &&
git add a/one &&
git commit -m test
'
test_expect_success 'ls-tree fails with non-zero exit code on broken tree' '
tree=$(git rev-parse HEAD:a) &&
rm -f .git/objects/$(echo $tree | sed -e "s,^\(..\),\1/,") &&
test_must_fail git ls-tree -r HEAD
'
test_done