(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'test diff with a bogus tree containing the null sha1'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <'create bogus tree'>)} { (SQ <'\n'> <'\tbogus_tree=$(\n'> <'\t\tprintf "100644 fooQQQQQQQQQQQQQQQQQQQQQ" |\n'> <'\t\tq_to_nul |\n'> <'\t\tgit hash-object -w --stdin -t tree\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'create tree with matching file'>)} { (SQ <'\n'> <'\techo bar >foo &&\n'> <'\tgit add foo &&\n'> <'\tgood_tree=$(git write-tree) &&\n'> <'\tblob=$(git rev-parse :foo)\n'> ) } ) (C {<test_expect_success>} {(SQ <'raw diff shows null sha1 (addition)'>)} { (SQ <'\n'> <'\techo ":000000 100644 $_z40 $_z40 A\tfoo" >expect &&\n'> <'\tgit diff-tree $EMPTY_TREE $bogus_tree >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'raw diff shows null sha1 (removal)'>)} { (SQ <'\n'> <'\techo ":100644 000000 $_z40 $_z40 D\tfoo" >expect &&\n'> <'\tgit diff-tree $bogus_tree $EMPTY_TREE >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'raw diff shows null sha1 (modification)'>)} { (SQ <'\n'> <'\techo ":100644 100644 $blob $_z40 M\tfoo" >expect &&\n'> <'\tgit diff-tree $good_tree $bogus_tree >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'raw diff shows null sha1 (other direction)'>)} { (SQ <'\n'> <'\techo ":100644 100644 $_z40 $blob M\tfoo" >expect &&\n'> <'\tgit diff-tree $bogus_tree $good_tree >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'raw diff shows null sha1 (reverse)'>)} { (SQ <'\n'> <'\techo ":100644 100644 $_z40 $blob M\tfoo" >expect &&\n'> <'\tgit diff-tree -R $good_tree $bogus_tree >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'raw diff shows null sha1 (index)'>)} { (SQ <'\n'> <'\techo ":100644 100644 $_z40 $blob M\tfoo" >expect &&\n'> <'\tgit diff-index $bogus_tree >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'patch fails due to bogus sha1 (addition)'>)} {(SQ <'\n'> <'\ttest_must_fail git diff-tree -p $EMPTY_TREE $bogus_tree\n'>)} ) (C {<test_expect_success>} {(SQ <'patch fails due to bogus sha1 (removal)'>)} {(SQ <'\n'> <'\ttest_must_fail git diff-tree -p $bogus_tree $EMPTY_TREE\n'>)} ) (C {<test_expect_success>} {(SQ <'patch fails due to bogus sha1 (modification)'>)} {(SQ <'\n'> <'\ttest_must_fail git diff-tree -p $good_tree $bogus_tree\n'>)} ) (C {<test_expect_success>} {(SQ <'patch fails due to bogus sha1 (other direction)'>)} {(SQ <'\n'> <'\ttest_must_fail git diff-tree -p $bogus_tree $good_tree\n'>)} ) (C {<test_expect_success>} {(SQ <'patch fails due to bogus sha1 (reverse)'>)} {(SQ <'\n'> <'\ttest_must_fail git diff-tree -R -p $good_tree $bogus_tree\n'>)} ) (C {<test_expect_success>} {(SQ <'patch fails due to bogus sha1 (index)'>)} {(SQ <'\n'> <'\ttest_must_fail git diff-index -p $bogus_tree\n'>)} ) (C {<test_done>}) ] )