(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'git grep in binary files'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <setup>)} { (DQ <'\n'> <'\techo \'binaryQfile\' | q_to_nul >a &&\n'> <'\tgit add a &&\n'> <'\tgit commit -m.\n'> ) } ) (C {<test_expect_success>} {(SQ <'git grep ina a'>)} { (SQ <'\n'> <'\techo Binary file a matches >expect &&\n'> <'\tgit grep ina a >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git grep -ah ina a'>)} {(SQ <'\n'> <'\tgit grep -ah ina a >actual &&\n'> <'\ttest_cmp a actual\n'>)} ) (C {<test_expect_success>} {(SQ <'git grep -I ina a'>)} { (SQ <'\n'> <'\t: >expect &&\n'> <'\ttest_must_fail git grep -I ina a >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git grep -c ina a'>)} { (SQ <'\n'> <'\techo a:1 >expect &&\n'> <'\tgit grep -c ina a >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git grep -l ina a'>)} { (SQ <'\n'> <'\techo a >expect &&\n'> <'\tgit grep -l ina a >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git grep -L bar a'>)} { (SQ <'\n'> <'\techo a >expect &&\n'> <'\tgit grep -L bar a >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git grep -q ina a'>)} { (SQ <'\n'> <'\t: >expect &&\n'> <'\tgit grep -q ina a >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git grep -F ile a'>)} {(SQ <'\n'> <'\tgit grep -F ile a\n'>)}) (C {<test_expect_success>} {(SQ <'git grep -Fi iLE a'>)} {(SQ <'\n'> <'\tgit grep -Fi iLE a\n'>)}) (C {<test_expect_success>} {(SQ <'git grep ile a'>)} {(SQ <'\n'> <'\tgit grep ile a\n'>)}) (C {<test_expect_failure>} {(SQ <'git grep .fi a'>)} {(SQ <'\n'> <'\tgit grep .fi a\n'>)}) (C {<test_expect_success>} {(SQ <'git grep -F y<NUL>f a'>)} {(DQ <'\n'> <'\tprintf \'yQf\' | q_to_nul >f &&\n'> <'\tgit grep -f f -F a\n'>)} ) (C {<test_expect_success>} {(SQ <'git grep -F y<NUL>x a'>)} {(DQ <'\n'> <'\tprintf \'yQx\' | q_to_nul >f &&\n'> <'\ttest_must_fail git grep -f f -F a\n'>)} ) (C {<test_expect_success>} {(SQ <'git grep -Fi Y<NUL>f a'>)} {(DQ <'\n'> <'\tprintf \'YQf\' | q_to_nul >f &&\n'> <'\tgit grep -f f -Fi a\n'>)} ) (C {<test_expect_success>} {(SQ <'git grep -Fi Y<NUL>x a'>)} {(DQ <'\n'> <'\tprintf \'YQx\' | q_to_nul >f &&\n'> <'\ttest_must_fail git grep -f f -Fi a\n'>)} ) (C {<test_expect_success>} {(SQ <'git grep y<NUL>f a'>)} {(DQ <'\n'> <'\tprintf \'yQf\' | q_to_nul >f &&\n'> <'\tgit grep -f f a\n'>)} ) (C {<test_expect_success>} {(SQ <'git grep y<NUL>x a'>)} {(DQ <'\n'> <'\tprintf \'yQx\' | q_to_nul >f &&\n'> <'\ttest_must_fail git grep -f f a\n'>)} ) (C {<test_expect_success>} {(SQ <'grep respects binary diff attribute'>)} { (SQ <'\n'> <'\techo text >t &&\n'> <'\tgit add t &&\n'> <'\techo t:text >expect &&\n'> <'\tgit grep text t >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\techo "t -diff" >.gitattributes &&\n'> <'\techo "Binary file t matches" >expect &&\n'> <'\tgit grep text t >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'grep --cached respects binary diff attribute'>)} {(SQ <'\n'> <'\tgit grep --cached text t >actual &&\n'> <'\ttest_cmp expect actual\n'>)} ) (C {<test_expect_success>} {(SQ <'grep --cached respects binary diff attribute (2)'>)} { (SQ <'\n'> <'\tgit add .gitattributes &&\n'> <'\trm .gitattributes &&\n'> <'\tgit grep --cached text t >actual &&\n'> <'\ttest_when_finished "git rm --cached .gitattributes" &&\n'> <'\ttest_when_finished "git checkout .gitattributes" &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'grep revision respects binary diff attribute'>)} { (SQ <'\n'> <'\tgit commit -m new &&\n'> <'\techo "Binary file HEAD:t matches" >expect &&\n'> <'\tgit grep text HEAD -- t >actual &&\n'> <'\ttest_when_finished "git reset HEAD^" &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'grep respects not-binary diff attribute'>)} { (SQ <'\n'> <'\techo binQary | q_to_nul >b &&\n'> <'\tgit add b &&\n'> <'\techo "Binary file b matches" >expect &&\n'> <'\tgit grep bin b >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\techo "b diff" >.gitattributes &&\n'> <'\techo "b:binQary" >expect &&\n'> <'\tgit grep bin b >actual.raw &&\n'> <'\tnul_to_q <actual.raw >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<nul_to_q_textconv>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(SQ <EOF>)} here_end_span_id: 357 stdin_parts: [<'#!/bin/sh\n'> <'"$PERL_PATH" -pe \'y/\\000/Q/\' < "$1"\n'>] ) ) ] do_fork: T ) (C {<chmod>} {<Id.Lit_Other '+'> <x>} {<nul_to_q_textconv>}) (C {<test_expect_success>} {(SQ <'setup textconv filters'>)} { (SQ <'\n'> <'\techo a diff=foo >.gitattributes &&\n'> <'\tgit config diff.foo.textconv "\\"$(pwd)\\""/nul_to_q_textconv\n'> ) } ) (C {<test_expect_success>} {(SQ <'grep does not honor textconv'>)} {(SQ <'\n'> <'\ttest_must_fail git grep Qfile\n'>)} ) (C {<test_expect_success>} {(SQ <'grep --textconv honors textconv'>)} { (SQ <'\n'> <'\techo "a:binaryQfile" >expect &&\n'> <'\tgit grep --textconv Qfile >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'grep --no-textconv does not honor textconv'>)} {(SQ <'\n'> <'\ttest_must_fail git grep --no-textconv Qfile\n'>)} ) (C {<test_expect_success>} {(SQ <'grep --textconv blob honors textconv'>)} { (SQ <'\n'> <'\techo "HEAD:a:binaryQfile" >expect &&\n'> <'\tgit grep --textconv Qfile HEAD:a >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )