ref-filter.c: drop return from void function
[git/debian.git] / t / t4054-diff-bogus-tree.sh
blob18f42c5fff9a6e3ccb56f9e3122c6c0469ad81a9
1 #!/bin/sh
3 test_description='test diff with a bogus tree containing the null sha1'
4 . ./test-lib.sh
6 test_expect_success 'create bogus tree' '
7 bogus_tree=$(
8 printf "100644 fooQQQQQQQQQQQQQQQQQQQQQ" |
9 q_to_nul |
10 git hash-object -w --stdin -t tree
14 test_expect_success 'create tree with matching file' '
15 echo bar >foo &&
16 git add foo &&
17 good_tree=$(git write-tree) &&
18 blob=$(git rev-parse :foo)
21 test_expect_success 'raw diff shows null sha1 (addition)' '
22 echo ":000000 100644 $_z40 $_z40 A foo" >expect &&
23 git diff-tree $EMPTY_TREE $bogus_tree >actual &&
24 test_cmp expect actual
27 test_expect_success 'raw diff shows null sha1 (removal)' '
28 echo ":100644 000000 $_z40 $_z40 D foo" >expect &&
29 git diff-tree $bogus_tree $EMPTY_TREE >actual &&
30 test_cmp expect actual
33 test_expect_success 'raw diff shows null sha1 (modification)' '
34 echo ":100644 100644 $blob $_z40 M foo" >expect &&
35 git diff-tree $good_tree $bogus_tree >actual &&
36 test_cmp expect actual
39 test_expect_success 'raw diff shows null sha1 (other direction)' '
40 echo ":100644 100644 $_z40 $blob M foo" >expect &&
41 git diff-tree $bogus_tree $good_tree >actual &&
42 test_cmp expect actual
45 test_expect_success 'raw diff shows null sha1 (reverse)' '
46 echo ":100644 100644 $_z40 $blob M foo" >expect &&
47 git diff-tree -R $good_tree $bogus_tree >actual &&
48 test_cmp expect actual
51 test_expect_success 'raw diff shows null sha1 (index)' '
52 echo ":100644 100644 $_z40 $blob M foo" >expect &&
53 git diff-index $bogus_tree >actual &&
54 test_cmp expect actual
57 test_expect_success 'patch fails due to bogus sha1 (addition)' '
58 test_must_fail git diff-tree -p $EMPTY_TREE $bogus_tree
61 test_expect_success 'patch fails due to bogus sha1 (removal)' '
62 test_must_fail git diff-tree -p $bogus_tree $EMPTY_TREE
65 test_expect_success 'patch fails due to bogus sha1 (modification)' '
66 test_must_fail git diff-tree -p $good_tree $bogus_tree
69 test_expect_success 'patch fails due to bogus sha1 (other direction)' '
70 test_must_fail git diff-tree -p $bogus_tree $good_tree
73 test_expect_success 'patch fails due to bogus sha1 (reverse)' '
74 test_must_fail git diff-tree -R -p $good_tree $bogus_tree
77 test_expect_success 'patch fails due to bogus sha1 (index)' '
78 test_must_fail git diff-index -p $bogus_tree
81 test_done