]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3103-ls-tree-misc.sh
Merge branch 'jt/reftable-geometric-compaction'
[thirdparty/git.git] / t / t3103-ls-tree-misc.sh
CommitLineData
6c1c1448
JS
1#!/bin/sh
2
3test_description='
4Miscellaneous tests for git ls-tree.
5
6 1. git ls-tree fails in presence of tree damage.
7
8'
9
809aeedb 10TEST_PASSES_SANITIZE_LEAK=true
6c1c1448
JS
11. ./test-lib.sh
12
13test_expect_success 'setup' '
14 mkdir a &&
15 touch a/one &&
16 git add a/one &&
17 git commit -m test
18'
19
04f89259 20test_expect_success 'ls-tree fails with non-zero exit code on broken tree' '
831c61cc 21 tree=$(git rev-parse HEAD:a) &&
22 rm -f .git/objects/$(echo $tree | sed -e "s,^\(..\),\1/,") &&
6c1c1448
JS
23 test_must_fail git ls-tree -r HEAD
24'
25
f6b224d5 26for opts in \
0f887835
ÆAB
27 "--long --name-only" \
28 "--name-only --name-status" \
cab851c2 29 "--name-status --object-only" \
0f887835 30 "--object-only --long"
f6b224d5
TL
31do
32 test_expect_success "usage: incompatible options: $opts" '
33 test_expect_code 129 git ls-tree $opts $tree
0f887835
ÆAB
34 '
35
36 one_opt=$(echo "$opts" | cut -d' ' -f1)
37 test_expect_success "usage: incompatible options: $one_opt and --format" '
38 test_expect_code 129 git ls-tree $one_opt --format=fmt $tree
39 '
f6b224d5 40done
6c1c1448 41test_done