(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <'git ls-files test (--with-tree).\n'> <'\n'> <'This test runs git ls-files --with-tree and in particular in\n'> <'a scenario known to trigger a crash with some versions of git.\n'> ) } spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <'\n'> <'\n'> <'\t# The bug we are exercising requires a fair number of entries\n'> <'\t# in a sub-directory so that add_index_entry will trigger a\n'> <'\t# realloc.\n'> <'\n'> <'\techo file >expected &&\n'> <'\tmkdir sub &&\n'> <'\tfor n in 0 1 2 3 4 5\n'> <'\tdo\n'> <'\t\tfor m in 0 1 2 3 4 5 6 7 8 9\n'> <'\t\tdo\n'> <'\t\t\tnum=00$n$m &&\n'> <'\t\t\t>sub/file-$num &&\n'> <'\t\t\techo file-$num >>expected ||\n'> <'\t\t\treturn 1\n'> <'\t\tdone\n'> <'\tdone &&\n'> <'\tgit add . &&\n'> <'\tgit commit -m "add a bunch of files" &&\n'> <'\n'> <'\t# We remove them all so that we will have something to add\n'> <'\t# back with --with-tree and so that we will definitely be\n'> <'\t# under the realloc size to trigger the bug.\n'> <'\trm -rf sub &&\n'> <'\tgit commit -a -m "remove them all" &&\n'> <'\n'> <'\t# The bug also requires some entry before our directory so that\n'> <'\t# prune_path will modify the_index.cache\n'> <'\n'> <'\tmkdir a_directory_that_sorts_before_sub &&\n'> <'\t>a_directory_that_sorts_before_sub/file &&\n'> <'\tmkdir sub &&\n'> <'\t>sub/file &&\n'> <'\tgit add .\n'> ) } ) (C {(test_expect_success)} {(SQ <'git -ls-files --with-tree should succeed from subdir'>)} { (SQ <'\n'> <'\t# We have to run from a sub-directory to trigger prune_path\n'> <'\t# Then we finally get to run our --with-tree test\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit ls-files --with-tree=HEAD~1 >../output\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'git -ls-files --with-tree should add entries from named tree.'>)} {(SQ <'test_cmp expected output'>)} ) (C {(test_done)}) ] )