(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'test tree diff when trees have duplicate entries'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: make_tree_entry body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<printf>} {(SQ <'%s %s\\0'>)} {(DQ ($ Id.VSub_Number '$1'))} {(DQ ($ Id.VSub_Number '$2'))} ) (C {<perl>} {<-e>} {(SQ <'print chr(hex($_)) for ($ARGV[0] =~ /../g)'>)} {(DQ ($ Id.VSub_Number '$3'))} ) ] ) ] ) ) (command.ShFunction name: make_tree body: (BraceGroup children: [ (command.Pipeline children: [ (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {($ Id.VSub_Pound '$#')} {<-gt>} {<2>}) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (C {<make_tree_entry>} {(DQ ($ Id.VSub_Number '$1'))} {(DQ ($ Id.VSub_Number '$2'))} {(DQ ($ Id.VSub_Number '$3'))} ) (command.Sentence child: (C {<shift>}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (C {<shift>}) terminator: <Id.Op_Semi _> ) (C {<shift>}) ] ) ) (C {<git>} {<hash-object>} {<-w>} {<-t>} {<tree>} {<--stdin>}) ] negated: F ) ] ) ) (C {<test_expect_success>} {(SQ <'create trees with duplicate entries'>)} { (SQ <'\n'> <'\tblob_one=$(echo one | git hash-object -w --stdin) &&\n'> <'\tblob_two=$(echo two | git hash-object -w --stdin) &&\n'> <'\tinner_one_a=$(make_tree \\\n'> <'\t\t100644 inner $blob_one\n'> <'\t) &&\n'> <'\tinner_one_b=$(make_tree \\\n'> <'\t\t100644 inner $blob_two \\\n'> <'\t\t100644 inner $blob_two \\\n'> <'\t\t100644 inner $blob_two\n'> <'\t) &&\n'> <'\touter_one=$(make_tree \\\n'> <'\t\t040000 outer $inner_one_a \\\n'> <'\t\t040000 outer $inner_one_b\n'> <'\t) &&\n'> <'\tinner_two=$(make_tree \\\n'> <'\t\t100644 inner $blob_one \\\n'> <'\t\t100644 inner $blob_two \\\n'> <'\t\t100644 inner $blob_two \\\n'> <'\t\t100644 inner $blob_two\n'> <'\t) &&\n'> <'\touter_two=$(make_tree \\\n'> <'\t\t040000 outer $inner_two\n'> <'\t) &&\n'> <'\tgit tag one $outer_one &&\n'> <'\tgit tag two $outer_two\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-tree between trees'>)} { (SQ <'\n'> <'\t{\n'> <'\t\tprintf ":000000 100644 $_z40 $blob_two A\\touter/inner\\n" &&\n'> <'\t\tprintf ":000000 100644 $_z40 $blob_two A\\touter/inner\\n" &&\n'> <'\t\tprintf ":000000 100644 $_z40 $blob_two A\\touter/inner\\n" &&\n'> <'\t\tprintf ":100644 000000 $blob_two $_z40 D\\touter/inner\\n" &&\n'> <'\t\tprintf ":100644 000000 $blob_two $_z40 D\\touter/inner\\n" &&\n'> <'\t\tprintf ":100644 000000 $blob_two $_z40 D\\touter/inner\\n"\n'> <'\t} >expect &&\n'> <'\tgit diff-tree -r --no-abbrev one two >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-tree with renames'>)} { (SQ <'\n'> <'\t# same expectation as above, since we disable rename detection\n'> <'\tgit diff-tree -M -r --no-abbrev one two >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )