(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: { (SQ <'git ls-tree test.\n'> <'\n'> <'This test runs git ls-tree with the following in a tree.\n'> <'\n'> <' path0 - a file\n'> <' path1\t- a symlink\n'> <' path2/foo - a file in a directory\n'> <' path2/bazbo - a symlink in a directory\n'> <' path2/baz/b - a file in a directory in a directory\n'> <'\n'> <'The new path restriction code should do the right thing for path2 and\n'> <'path2/baz. Also path0/ should snow nothing.\n'> ) } spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'mkdir path2 path2/baz &&\n'> <' echo Hi >path0 &&\n'> <' test_ln_s_add path0 path1 &&\n'> <' test_ln_s_add ../path1 path2/bazbo &&\n'> <' echo Lo >path2/foo &&\n'> <' echo Mi >path2/baz/b &&\n'> <' find path? \\( -type f -o -type l \\) -print |\n'> <' xargs git update-index --add &&\n'> <' tree=$(git write-tree) &&\n'> <' echo $tree'> ) } ) (command.ShFunction name: test_output body: (BraceGroup children: [ (command.Simple words: [{<sed>} {<-e>} {(DQ <'s/ '> ($ Id.VSub_DollarName '$_x40') <'\t/ X\t/'>)}] redirects: [ (redir op:<Id.Redir_Less '<'> loc:(redir_loc.Fd fd:0) arg:{<current>}) (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<check>}) ] do_fork: T ) (C {<test_cmp>} {<expected>} {<check>}) ] ) ) (C {<test_expect_success>} {(SQ <'ls-tree plain'>)} { (SQ <'git ls-tree $tree >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'100644 blob X\tpath0\n'> <'120000 blob X\tpath1\n'> <'040000 tree X\tpath2\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree recursive'>)} { (SQ <'git ls-tree -r $tree >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'100644 blob X\tpath0\n'> <'120000 blob X\tpath1\n'> <'100644 blob X\tpath2/baz/b\n'> <'120000 blob X\tpath2/bazbo\n'> <'100644 blob X\tpath2/foo\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree recursive with -t'>)} { (SQ <'git ls-tree -r -t $tree >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'100644 blob X\tpath0\n'> <'120000 blob X\tpath1\n'> <'040000 tree X\tpath2\n'> <'040000 tree X\tpath2/baz\n'> <'100644 blob X\tpath2/baz/b\n'> <'120000 blob X\tpath2/bazbo\n'> <'100644 blob X\tpath2/foo\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree recursive with -d'>)} { (SQ <'git ls-tree -r -d $tree >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'040000 tree X\tpath2\n'> <'040000 tree X\tpath2/baz\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree filtered with path'>)} { (SQ <'git ls-tree $tree path >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree filtered with path1 path0'>)} { (SQ <'git ls-tree $tree path1 path0 >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'100644 blob X\tpath0\n'> <'120000 blob X\tpath1\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree filtered with path0/'>)} { (SQ <'git ls-tree $tree path0/ >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree filtered with path2'>)} { (SQ <'git ls-tree $tree path2 >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'040000 tree X\tpath2\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree filtered with path2/'>)} { (SQ <'git ls-tree $tree path2/ >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'040000 tree X\tpath2/baz\n'> <'120000 blob X\tpath2/bazbo\n'> <'100644 blob X\tpath2/foo\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree filtered with path2/baz'>)} { (SQ <'git ls-tree $tree path2/baz >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'040000 tree X\tpath2/baz\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree filtered with path2/bak'>)} { (SQ <'git ls-tree $tree path2/bak >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree -t filtered with path2/bak'>)} { (SQ <'git ls-tree -t $tree path2/bak >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'040000 tree X\tpath2\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree with one path a prefix of the other'>)} { (SQ <'git ls-tree $tree path2/baz path2/bazbo >current &&\n'> <' cat >expected <<\\EOF &&\n'> <'040000 tree X\tpath2/baz\n'> <'120000 blob X\tpath2/bazbo\n'> <'EOF\n'> <' test_output'> ) } ) (C {<test_done>}) ] )