(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'filter-branch removal of trees with null sha1'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <'setup: base commits'>)} {(SQ <'\n'> <'\ttest_commit one &&\n'> <'\ttest_commit two &&\n'> <'\ttest_commit three\n'>)} ) (C {<test_expect_success>} {(SQ <'setup: a commit with a bogus null sha1 in the tree'>)} { (SQ <'\n'> <'\t{\n'> <'\t\tgit ls-tree HEAD &&\n'> <'\t\tprintf "160000 commit $_z40\\\\tbroken\\\\n"\n'> <'\t} >broken-tree &&\n'> <'\techo "add broken entry" >msg &&\n'> <'\n'> <'\ttree=$(git mktree <broken-tree) &&\n'> <'\ttest_tick &&\n'> <'\tcommit=$(git commit-tree $tree -p HEAD <msg) &&\n'> <'\tgit update-ref HEAD "$commit"\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup: bring HEAD and index in sync'>)} {(SQ <'\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "back to normal"\n'>)} ) (C {<test_expect_success>} {(SQ <'filter commands are still checked'>)} { (SQ <'\n'> <'\ttest_must_fail git filter-branch \\\n'> <'\t\t--force --prune-empty \\\n'> <'\t\t--index-filter "git rm --cached --ignore-unmatch three.t"\n'> ) } ) (C {<test_expect_success>} {(SQ <'removing the broken entry works'>)} { (SQ <'\n'> <'\techo three >expect &&\n'> <'\tgit filter-branch \\\n'> <'\t\t--force --prune-empty \\\n'> <'\t\t--index-filter "git rm --cached --ignore-unmatch broken" &&\n'> <'\tgit log -1 --format=%s >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )