]>
Commit | Line | Data |
---|---|---|
6c1c1448 JS |
1 | #!/bin/sh |
2 | ||
3 | test_description=' | |
4 | Miscellaneous tests for git ls-tree. | |
5 | ||
6 | 1. git ls-tree fails in presence of tree damage. | |
7 | ||
8 | ' | |
9 | ||
809aeedb | 10 | TEST_PASSES_SANITIZE_LEAK=true |
6c1c1448 JS |
11 | . ./test-lib.sh |
12 | ||
13 | test_expect_success 'setup' ' | |
14 | mkdir a && | |
15 | touch a/one && | |
16 | git add a/one && | |
17 | git commit -m test | |
18 | ' | |
19 | ||
04f89259 | 20 | test_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 | 26 | for 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 |
31 | do |
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 | 40 | done |
6c1c1448 | 41 | test_done |