t7800: improve test descriptions with empty arguments
[alt-git.git] / t / t4054-diff-bogus-tree.sh
blob05c88f8cdf01d98b61eacff08b32cb57320e7d3b
1 #!/bin/sh
3 test_description='test diff with a bogus tree containing the null sha1'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'create bogus tree' '
9 name=$(echo $ZERO_OID | sed -e "s/00/Q/g") &&
10 bogus_tree=$(
11 printf "100644 fooQ$name" |
12 q_to_nul |
13 git hash-object --literally -w --stdin -t tree
17 test_expect_success 'create tree with matching file' '
18 echo bar >foo &&
19 git add foo &&
20 good_tree=$(git write-tree) &&
21 blob=$(git rev-parse :foo)
24 test_expect_success 'raw diff shows null sha1 (addition)' '
25 echo ":000000 100644 $ZERO_OID $ZERO_OID A foo" >expect &&
26 git diff-tree $EMPTY_TREE $bogus_tree >actual &&
27 test_cmp expect actual
30 test_expect_success 'raw diff shows null sha1 (removal)' '
31 echo ":100644 000000 $ZERO_OID $ZERO_OID D foo" >expect &&
32 git diff-tree $bogus_tree $EMPTY_TREE >actual &&
33 test_cmp expect actual
36 test_expect_success 'raw diff shows null sha1 (modification)' '
37 echo ":100644 100644 $blob $ZERO_OID M foo" >expect &&
38 git diff-tree $good_tree $bogus_tree >actual &&
39 test_cmp expect actual
42 test_expect_success 'raw diff shows null sha1 (other direction)' '
43 echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
44 git diff-tree $bogus_tree $good_tree >actual &&
45 test_cmp expect actual
48 test_expect_success 'raw diff shows null sha1 (reverse)' '
49 echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
50 git diff-tree -R $good_tree $bogus_tree >actual &&
51 test_cmp expect actual
54 test_expect_success 'raw diff shows null sha1 (index)' '
55 echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
56 git diff-index $bogus_tree >actual &&
57 test_cmp expect actual
60 test_expect_success 'patch fails due to bogus sha1 (addition)' '
61 test_must_fail git diff-tree -p $EMPTY_TREE $bogus_tree
64 test_expect_success 'patch fails due to bogus sha1 (removal)' '
65 test_must_fail git diff-tree -p $bogus_tree $EMPTY_TREE
68 test_expect_success 'patch fails due to bogus sha1 (modification)' '
69 test_must_fail git diff-tree -p $good_tree $bogus_tree
72 test_expect_success 'patch fails due to bogus sha1 (other direction)' '
73 test_must_fail git diff-tree -p $bogus_tree $good_tree
76 test_expect_success 'patch fails due to bogus sha1 (reverse)' '
77 test_must_fail git diff-tree -R -p $good_tree $bogus_tree
80 test_expect_success 'patch fails due to bogus sha1 (index)' '
81 test_must_fail git diff-index -p $bogus_tree
84 test_done