(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'git grep various.\n'>)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(hello.c)} spids:[26])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('#include <assert.h>\n') ('#include <stdio.h>\n') ('\n') 
                ('int main(int argc, const char **argv)\n') ('{\n') ('\tprintf(') (Right_DoubleQuote '"') ('Hello world.') 
                (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) (Right_DoubleQuote '"') (');\n') ('\treturn 0;\n') ('\t/* char ?? */\n') ('}\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [29]
        )
      ]
    )
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <'\n'> <'\t{\n'> <'\t\techo foo mmap bar\n'> <'\t\techo foo_mmap bar\n'> 
          <'\t\techo foo_mmap bar mmap\n'> <'\t\techo foo mmap bar_mmap\n'> <'\t\techo foo_mmap bar mmap baz\n'> <'\t} >file &&\n'> <'\t{\n'> 
          <'\t\techo Hello world\n'> <'\t\techo HeLLo world\n'> <'\t\techo Hello_world\n'> <'\t\techo HeLLo_world\n'> 
          <'\t} >hello_world &&\n'> <'\t{\n'> <'\t\techo "a+b*c"\n'> <'\t\techo "a+bc"\n'> <'\t\techo "abc"\n'> <'\t} >ab &&\n'> 
          <'\techo vvv >v &&\n'> <'\techo ww w >w &&\n'> <'\techo x x xx x >x &&\n'> <'\techo y yy >y &&\n'> <'\techo zzz > z &&\n'> 
          <'\tmkdir t &&\n'> <'\techo test >t/t &&\n'> <'\techo vvv >t/v &&\n'> <'\tmkdir t/a &&\n'> <'\techo vvv >t/a/v &&\n'> 
          <'\t{\n'> <'\t\techo "line without leading space1"\n'> <'\t\techo " line with leading space1"\n'> 
          <'\t\techo " line with leading space2"\n'> <'\t\techo " line with leading space3"\n'> <'\t\techo "line without leading space2"\n'> 
          <'\t} >space &&\n'> <'\tgit add . &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m initial\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep should not segfault with a bad input'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git grep "("\n'>)}
    )
    (ForEach
      iter_name: H
      iter_words: [{(HEAD)} {(SQ )}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {(DQ ($ VSub_Name '$H'))}
              arms: [
                (case_arm
                  pat_list: [{(HEAD)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:HC)
                          op: Equal
                          rhs: {(SQ <'HEAD:'>)}
                          spids: [133]
                        )
                        (assign_pair
                          lhs: (LhsName name:L)
                          op: Equal
                          rhs: {(SQ <HEAD>)}
                          spids: [138]
                        )
                      ]
                      spids: [133]
                    )
                  ]
                  spids: [130 131 143 -1]
                )
                (case_arm
                  pat_list: [{(SQ )}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:HC)
                          op: Equal
                          rhs: {(SQ )}
                          spids: [150]
                        )
                        (assign_pair
                          lhs: (LhsName name:L)
                          op: Equal
                          rhs: {(SQ <'in working tree'>)}
                          spids: [152]
                        )
                      ]
                      spids: [150]
                    )
                  ]
                  spids: [-1 148 157 -1]
                )
              ]
              spids: [121 127 160]
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}file:1:foo mmap bar\n'> 
                  <'\t\t\techo ${HC}file:3:foo_mmap bar mmap\n'> <'\t\t\techo ${HC}file:4:foo mmap bar_mmap\n'> <'\t\t\techo ${HC}file:5:foo_mmap bar mmap baz\n'> 
                  <'\t\t} >expected &&\n'> <'\t\tgit -c grep.linenumber=false grep -n -w -e mmap $H >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}file:1:foo mmap bar\n'> 
                  <'\t\t\techo ${HC}file:3:foo_mmap bar mmap\n'> <'\t\t\techo ${HC}file:4:foo mmap bar_mmap\n'> <'\t\t\techo ${HC}file:5:foo_mmap bar mmap baz\n'> 
                  <'\t\t} >expected &&\n'> <'\t\tgit -c grep.linenumber=true grep -w -e mmap $H >actual &&\n'> <'\t\ttest_cmp expected actual\n'> 
                  <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}file:foo mmap bar\n'> 
                  <'\t\t\techo ${HC}file:foo_mmap bar mmap\n'> <'\t\t\techo ${HC}file:foo mmap bar_mmap\n'> <'\t\t\techo ${HC}file:foo_mmap bar mmap baz\n'> 
                  <'\t\t} >expected &&\n'> <'\t\tgit -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L') (' (w)'))} 
              {
                (SQ <'\n'> <'\t\t: >expected &&\n'> 
                  <'\t\ttest_must_fail git grep -n -w -e "^w" $H >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L') (' (x)'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}x:1:x x xx x\n'> <'\t\t} >expected &&\n'> 
                  <'\t\tgit grep -n -w -e "x xx* x" $H >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L') (' (y-1)'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}y:1:y yy\n'> <'\t\t} >expected &&\n'> 
                  <'\t\tgit grep -n -w -e "^y" $H >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L') (' (y-2)'))} 
              {
                (SQ <'\n'> <'\t\t: >expected &&\n'> <'\t\tif git grep -n -w -e "^y y" $H >actual\n'> 
                  <'\t\tthen\n'> <'\t\t\techo should not have matched\n'> <'\t\t\tcat actual\n'> <'\t\t\tfalse\n'> <'\t\telse\n'> 
                  <'\t\t\ttest_cmp expected actual\n'> <'\t\tfi\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -w ') ($ VSub_Name '$L') (' (z)'))} 
              {
                (SQ <'\n'> <'\t\t: >expected &&\n'> <'\t\tif git grep -n -w -e "^z" $H >actual\n'> 
                  <'\t\tthen\n'> <'\t\t\techo should not have matched\n'> <'\t\t\tcat actual\n'> <'\t\t\tfalse\n'> <'\t\telse\n'> 
                  <'\t\t\ttest_cmp expected actual\n'> <'\t\tfi\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep ') ($ VSub_Name '$L') (' (t-1)'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}t/t:1:test" >expected &&\n'> 
                  <'\t\tgit grep -n -e test $H >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep ') ($ VSub_Name '$L') (' (t-2)'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}t:1:test" >expected &&\n'> <'\t\t(\n'> <'\t\t\tcd t &&\n'> 
                  <'\t\t\tgit grep -n -e test $H\n'> <'\t\t) >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep ') ($ VSub_Name '$L') (' (t-3)'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}t/t:1:test" >expected &&\n'> <'\t\t(\n'> <'\t\t\tcd t &&\n'> 
                  <'\t\t\tgit grep --full-name -n -e test $H\n'> <'\t\t) >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep -c ') ($ VSub_Name '$L') (' (no /dev/null)'))} 
              {(SQ <'\n'> <'\t\t! git grep -c test $H | grep /dev/null\n'> <'\t'>)}
            )
            (C {(test_expect_success)} {(DQ ('grep --max-depth -1 ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}t/a/v:1:vvv\n'> <'\t\t\techo ${HC}t/v:1:vvv\n'> 
                  <'\t\t\techo ${HC}v:1:vvv\n'> <'\t\t} >expected &&\n'> <'\t\tgit grep --max-depth -1 -n -e vvv $H >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep --max-depth 0 ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}v:1:vvv\n'> <'\t\t} >expected &&\n'> 
                  <'\t\tgit grep --max-depth 0 -n -e vvv $H >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ("grep --max-depth 0 -- '*' ") ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}t/a/v:1:vvv\n'> <'\t\t\techo ${HC}t/v:1:vvv\n'> 
                  <'\t\t\techo ${HC}v:1:vvv\n'> <'\t\t} >expected &&\n'> <'\t\tgit grep --max-depth 0 -n -e vvv $H -- "*" >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep --max-depth 1 ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}t/v:1:vvv\n'> <'\t\t\techo ${HC}v:1:vvv\n'> 
                  <'\t\t} >expected &&\n'> <'\t\tgit grep --max-depth 1 -n -e vvv $H >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep --max-depth 0 -- t ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}t/v:1:vvv\n'> <'\t\t} >expected &&\n'> 
                  <'\t\tgit grep --max-depth 0 -n -e vvv $H -- t >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep --max-depth 0 -- . t ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}t/v:1:vvv\n'> <'\t\t\techo ${HC}v:1:vvv\n'> 
                  <'\t\t} >expected &&\n'> <'\t\tgit grep --max-depth 0 -n -e vvv $H -- . t >actual &&\n'> <'\t\ttest_cmp expected actual\n'> 
                  <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep --max-depth 0 -- t . ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\t{\n'> <'\t\t\techo ${HC}t/v:1:vvv\n'> <'\t\t\techo ${HC}v:1:vvv\n'> 
                  <'\t\t} >expected &&\n'> <'\t\tgit grep --max-depth 0 -n -e vvv $H -- t . >actual &&\n'> <'\t\ttest_cmp expected actual\n'> 
                  <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {(DQ ('grep ') ($ VSub_Name '$L') (' with grep.extendedRegexp=false'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:a+bc" >expected &&\n'> 
                  <'\t\tgit -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {(DQ ('grep ') ($ VSub_Name '$L') (' with grep.extendedRegexp=true'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:abc" >expected &&\n'> 
                  <'\t\tgit -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {(DQ ('grep ') ($ VSub_Name '$L') (' with grep.patterntype=basic'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:a+bc" >expected &&\n'> 
                  <'\t\tgit -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {(DQ ('grep ') ($ VSub_Name '$L') (' with grep.patterntype=extended'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:abc" >expected &&\n'> 
                  <'\t\tgit -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {(DQ ('grep ') ($ VSub_Name '$L') (' with grep.patterntype=fixed'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:a+b*c" >expected &&\n'> 
                  <'\t\tgit -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(LIBPCRE)} 
              {(DQ ('grep ') ($ VSub_Name '$L') (' with grep.patterntype=perl'))} 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:a+b*c" >expected &&\n'> 
                  <'\t\tgit -c grep.patterntype=perl grep "a\\x{2b}b\\x{2a}c" $H ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {
                (DQ ('grep ') ($ VSub_Name '$L') 
                  (' with grep.patternType=default and grep.extendedRegexp=true')
                )
              } 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:abc" >expected &&\n'> <'\t\tgit \\\n'> 
                  <'\t\t\t-c grep.patternType=default \\\n'> <'\t\t\t-c grep.extendedRegexp=true \\\n'> <'\t\t\tgrep "a+b*c" $H ab >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {
                (DQ ('grep ') ($ VSub_Name '$L') 
                  (' with grep.extendedRegexp=true and grep.patternType=default')
                )
              } 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:abc" >expected &&\n'> <'\t\tgit \\\n'> 
                  <'\t\t\t-c grep.extendedRegexp=true \\\n'> <'\t\t\t-c grep.patternType=default \\\n'> <'\t\t\tgrep "a+b*c" $H ab >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {
                (DQ ('grep ') ($ VSub_Name '$L') 
                  (' with grep.patternType=extended and grep.extendedRegexp=false')
                )
              } 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:abc" >expected &&\n'> <'\t\tgit \\\n'> 
                  <'\t\t\t-c grep.patternType=extended \\\n'> <'\t\t\t-c grep.extendedRegexp=false \\\n'> <'\t\t\tgrep "a+b*c" $H ab >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {
                (DQ ('grep ') ($ VSub_Name '$L') 
                  (' with grep.patternType=basic and grep.extendedRegexp=true')
                )
              } 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:a+bc" >expected &&\n'> <'\t\tgit \\\n'> 
                  <'\t\t\t-c grep.patternType=basic \\\n'> <'\t\t\t-c grep.extendedRegexp=true \\\n'> <'\t\t\tgrep "a+b*c" $H ab >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {
                (DQ ('grep ') ($ VSub_Name '$L') 
                  (' with grep.extendedRegexp=false and grep.patternType=extended')
                )
              } 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:abc" >expected &&\n'> <'\t\tgit \\\n'> 
                  <'\t\t\t-c grep.extendedRegexp=false \\\n'> <'\t\t\t-c grep.patternType=extended \\\n'> <'\t\t\tgrep "a+b*c" $H ab >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {
                (DQ ('grep ') ($ VSub_Name '$L') 
                  (' with grep.extendedRegexp=true and grep.patternType=basic')
                )
              } 
              {
                (SQ <'\n'> <'\t\techo "${HC}ab:a+bc" >expected &&\n'> <'\t\tgit \\\n'> 
                  <'\t\t\t-c grep.extendedRegexp=true \\\n'> <'\t\t\t-c grep.patternType=basic \\\n'> <'\t\t\tgrep "a+b*c" $H ab >actual &&\n'> 
                  <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep --count ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\techo ${HC}ab:3 >expected &&\n'> 
                  <'\t\tgit grep --count -e b $H -- ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(DQ ('grep --count -h ') ($ VSub_Name '$L'))} 
              {
                (SQ <'\n'> <'\t\techo 3 >expected &&\n'> 
                  <'\t\tgit grep --count -h -e b $H -- ab >actual &&\n'> <'\t\ttest_cmp expected actual\n'> <'\t'>
                )
              }
            )
          ]
          spids: [118 819]
        )
      spids: [112 -1]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[824])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('file\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [827]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -l -C'>)} 
      {(SQ <'\n'> <'\tgit grep -l -C1 foo >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[847])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('file:5\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [850]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -c -C'>)} 
      {(SQ <'\n'> <'\tgit grep -c -C1 foo >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep -L -C'>)} 
      {
        (SQ <'\n'> <'\tgit ls-files >expected &&\n'> 
          <'\tgit grep -L -C1 nonexistent_string >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[884])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('file:foo mmap bar_mmap\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [887]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -e A --and -e B'>)} 
      {
        (SQ <'\n'> <'\tgit grep -e "foo mmap" --and -e bar_mmap >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[908])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('file:foo_mmap bar mmap\n') ('file:foo_mmap bar mmap baz\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [911]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep ( -e A --or -e B ) --and -e B'>)} 
      {
        (SQ <'\n'> <'\tgit grep \\( -e foo_ --or -e baz \\) \\\n'> 
          <'\t\t--and -e " mmap" >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[935])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('file:foo mmap bar\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [938]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -e A --and --not -e B'>)} 
      {
        (SQ <'\n'> <'\tgit grep -e "foo mmap" --and --not -e bar_mmap >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep should ignore GREP_OPTIONS'>)} 
      {
        (SQ <'\n'> <'\tGREP_OPTIONS=-v git grep " mmap bar\\$" >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -f, non-existent file'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git grep -f patterns\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[984])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('file:foo mmap bar\n') ('file:foo_mmap bar\n') ('file:foo_mmap bar mmap\n') 
                ('file:foo mmap bar_mmap\n') ('file:foo_mmap bar mmap baz\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [987]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(pattern)} spids:[999])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('mmap\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1002]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -f, one pattern'>)} 
      {(SQ <'\n'> <'\tgit grep -f pattern >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1023])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('file:foo mmap bar\n') ('file:foo_mmap bar\n') ('file:foo_mmap bar mmap\n') 
                ('file:foo mmap bar_mmap\n') ('file:foo_mmap bar mmap baz\n') ('t/a/v:vvv\n') ('t/v:vvv\n') ('v:vvv\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1026]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(patterns)} spids:[1041])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('mmap\n') ('vvv\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1044]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -f, multiple patterns'>)} 
      {(SQ <'\n'> <'\tgit grep -f patterns >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep, multiple patterns'>)} 
      {(SQ <'\n'> <'\tgit grep "$(cat patterns)" >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1079])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('file:foo mmap bar\n') ('file:foo_mmap bar\n') ('file:foo_mmap bar mmap\n') 
                ('file:foo mmap bar_mmap\n') ('file:foo_mmap bar mmap baz\n') ('t/a/v:vvv\n') ('t/v:vvv\n') ('v:vvv\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1082]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(patterns)} spids:[1097])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('\n') ('mmap\n') ('\n') ('vvv\n') ('\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1100]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -f, ignore empty lines'>)} 
      {(SQ <'\n'> <'\tgit grep -f patterns >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep -f, ignore empty lines, read patterns from stdin'>)} 
      {(SQ <'\n'> <'\tgit grep -f - <patterns >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1138])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('y:y yy\n') ('--\n') ('z:zzz\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1141]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -q, silently report matches'>)} 
      {
        (SQ <'\n'> <'\t>empty &&\n'> <'\tgit grep -q mmap >actual &&\n'> 
          <'\ttest_cmp empty actual &&\n'> <'\ttest_must_fail git grep -q qfwfq >actual &&\n'> <'\ttest_cmp empty actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -C1 hunk mark between files'>)} 
      {(SQ <'\n'> <'\tgit grep -C1 "^[yz]" >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'log grep setup'>)} 
      {
        (SQ <'\n'> <'\techo a >>file &&\n'> <'\ttest_tick &&\n'> 
          <'\tGIT_AUTHOR_NAME="With * Asterisk" \\\n'> <'\tGIT_AUTHOR_EMAIL="xyzzy@frotz.com" \\\n'> <'\tgit commit -a -m "second" &&\n'> <'\n'> 
          <'\techo a >>file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "third" &&\n'> <'\n'> <'\techo a >>file &&\n'> 
          <'\ttest_tick &&\n'> <'\tGIT_AUTHOR_NAME="Night Fall" \\\n'> <'\tGIT_AUTHOR_EMAIL="nitfol@frobozz.com" \\\n'> 
          <'\tgit commit -a -m "fourth"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (1)'>)} 
      {
        (SQ <'\n'> <'\tgit log --author=author --pretty=tformat:%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo third && echo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (2)'>)} 
      {
        (SQ <'\n'> <'\tgit log --author=" * " -F --pretty=tformat:%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo second\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (3)'>)} 
      {
        (SQ <'\n'> <'\tgit log --author="^A U" --pretty=tformat:%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo third && echo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (4)'>)} 
      {
        (SQ <'\n'> <'\tgit log --author="frotz\\.com>$" --pretty=tformat:%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo second\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (5)'>)} 
      {
        (SQ <'\n'> <'\tgit log --author=Thor -F --pretty=tformat:%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo third && echo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (6)'>)} 
      {
        (SQ <'\n'> <'\tgit log --author=-0700  --pretty=tformat:%s >actual &&\n'> <'\t>expect &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (7)'>)} 
      {
        (SQ <'\n'> <'\tgit log -g --grep-reflog="commit: third" --pretty=tformat:%s >actual &&\n'> 
          <'\techo third >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (8)'>)} 
      {
        (SQ <'\n'> 
          <
'\tgit log -g --grep-reflog="commit: third" --grep-reflog="commit: second" --pretty=tformat:%s >actual &&\n'
          > <'\t{\n'> <'\t\techo third && echo second\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (9)'>)} 
      {
        (SQ <'\n'> 
          <
'\tgit log -g --grep-reflog="commit: third" --author="Thor" --pretty=tformat:%s >actual &&\n'
          > <'\techo third >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log grep (9)'>)} 
      {
        (SQ <'\n'> 
          <
'\tgit log -g --grep-reflog="commit: third" --author="non-existent" --pretty=tformat:%s >actual &&\n'
          > <'\t: >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log --grep-reflog can only be used under -g'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git log --grep-reflog="commit: third"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'log with multiple --grep uses union'>)} 
      {
        (SQ <'\n'> <'\tgit log --grep=i --grep=r --format=%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo fourth && echo third && echo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log --all-match with multiple --grep uses intersection'>)} 
      {
        (SQ <'\n'> <'\tgit log --all-match --grep=i --grep=r --format=%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo third\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log with multiple --author uses union'>)} 
      {
        (SQ <'\n'> <'\tgit log --author="Thor" --author="Aster" --format=%s >actual &&\n'> <'\t{\n'> 
          <'\t    echo third && echo second && echo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log --all-match with multiple --author still uses union'>)} 
      {
        (SQ <'\n'> <'\tgit log --all-match --author="Thor" --author="Aster" --format=%s >actual &&\n'> 
          <'\t{\n'> <'\t    echo third && echo second && echo initial\n'> <'\t} >expect &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log --grep --author uses intersection'>)} 
      {
        (SQ <'\n'> <'\t# grep matches only third and fourth\n'> 
          <'\t# author matches only initial and third\n'> <'\tgit log --author="A U Thor" --grep=r --format=%s >actual &&\n'> <'\t{\n'> <'\t\techo third\n'> 
          <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'log --grep --grep --author takes union of greps and intersects with author'>)} 
      {
        (SQ <'\n'> <'\t# grep matches initial and second but not third\n'> 
          <'\t# author matches only initial and third\n'> <'\tgit log --author="A U Thor" --grep=s --grep=l --format=%s >actual &&\n'> <'\t{\n'> 
          <'\t\techo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          <
'log ---all-match -grep --author --author still takes union of authors and intersects with grep'
          >
        )
      } 
      {
        (SQ <'\n'> <'\t# grep matches only initial and third\n'> 
          <'\t# author matches all but second\n'> <'\tgit log --all-match --author="Thor" --author="Night" --grep=i --format=%s >actual &&\n'> <'\t{\n'> 
          <'\t    echo third && echo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'log --grep --author --author takes union of authors and intersects with grep'>)} 
      {
        (SQ <'\n'> <'\t# grep matches only initial and third\n'> 
          <'\t# author matches all but second\n'> <'\tgit log --author="Thor" --author="Night" --grep=i --format=%s >actual &&\n'> <'\t{\n'> 
          <'\t    echo third && echo initial\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log --all-match --grep --grep --author takes intersection'>)} 
      {
        (SQ <'\n'> <'\t# grep matches only third\n'> <'\t# author matches only initial and third\n'> 
          <'\tgit log --all-match --author="A U Thor" --grep=i --grep=r --format=%s >actual &&\n'> <'\t{\n'> <'\t\techo third\n'> <'\t} >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log --author does not search in timestamp'>)} 
      {
        (SQ <'\n'> <'\t: >expect &&\n'> <'\tgit log --author="$GIT_AUTHOR_DATE" >actual &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'log --committer does not search in timestamp'>)} 
      {
        (SQ <'\n'> <'\t: >expect &&\n'> <'\tgit log --committer="$GIT_COMMITTER_DATE" >actual &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep with CE_VALID file'>)} 
      {
        (SQ <'\n'> <'\tgit update-index --assume-unchanged t/t &&\n'> <'\trm t/t &&\n'> 
          <'\ttest "$(git grep test)" = "t/t:test" &&\n'> <'\tgit update-index --no-assume-unchanged t/t &&\n'> <'\tgit checkout t/t\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1568])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('hello.c=#include <stdio.h>\n') ('hello.c:\treturn 0;\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1571]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -p with userdiff'>)} 
      {
        (SQ <'\n'> <'\tgit config diff.custom.funcname "^#" &&\n'> 
          <'\techo "hello.c diff=custom" >.gitattributes &&\n'> <'\tgit grep -p return >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1595])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('hello.c=int main(int argc, const char **argv)\n') ('hello.c:\treturn 0;\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1598]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -p'>)} 
      {
        (SQ <'\n'> <'\trm -f .gitattributes &&\n'> <'\tgit grep -p return >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1621])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c-#include <stdio.h>\n') ('hello.c-\n') 
                ('hello.c=int main(int argc, const char **argv)\n') ('hello.c-{\n') ('hello.c-\tprintf(') (Right_DoubleQuote '"') ('Hello world.') 
                (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) (Right_DoubleQuote '"') (');\n') ('hello.c:\treturn 0;\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1624]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -p -B5'>)} 
      {(SQ <'\n'> <'\tgit grep -p -B5 return >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1655])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c=int main(int argc, const char **argv)\n') ('hello.c-{\n') 
                ('hello.c-\tprintf(') (Right_DoubleQuote '"') ('Hello world.') (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) 
                (Right_DoubleQuote '"') (');\n') ('hello.c:\treturn 0;\n') ('hello.c-\t/* char ?? */\n') ('hello.c-}\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1658]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -W'>)} 
      {(SQ <'\n'> <'\tgit grep -W return >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1689])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('hello.c-#include <assert.h>\n') ('hello.c:#include <stdio.h>\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1692]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -W shows no trailing empty lines'>)} 
      {(SQ <'\n'> <'\tgit grep -W stdio >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1714])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c=\tprintf(') (Right_DoubleQuote '"') ('Hello world.') 
                (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) (Right_DoubleQuote '"') (');\n') ('hello.c:\treturn 0;\n') ('hello.c-\t/* char ?? */\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1717]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -W with userdiff'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -f .gitattributes" &&\n'> 
          <'\tgit config diff.custom.xfuncname "(printf.*|})$" &&\n'> <'\techo "hello.c diff=custom" >.gitattributes &&\n'> <'\tgit grep -W return >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep from a subdirectory to search wider area (1)'>)} 
      {(SQ <'\n'> <'\tmkdir -p s &&\n'> <'\t(\n'> <'\t\tcd s && git grep "x x x" ..\n'> <'\t)\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep from a subdirectory to search wider area (2)'>)} 
      {
        (SQ <'\n'> <'\tmkdir -p s &&\n'> <'\t(\n'> <'\t\tcd s || exit 1\n'> 
          <'\t\t( git grep xxyyzz .. >out ; echo $? >status )\n'> <'\t\t! test -s out &&\n'> <'\t\ttest 1 = $(cat status)\n'> <'\t)\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1781])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('hello.c:int main(int argc, const char **argv)\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1784]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -Fi'>)} 
      {(SQ <'\n'> <'\tgit grep -Fi "CHAR *" >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'outside of git repository'>)} 
      {
        (SQ <'\n'> <'\trm -fr non &&\n'> <'\tmkdir -p non/git/sub &&\n'> 
          <'\techo hello >non/git/file1 &&\n'> <'\techo world >non/git/sub/file2 &&\n'> <'\t{\n'> <'\t\techo file1:hello &&\n'> 
          <'\t\techo sub/file2:world\n'> <'\t} >non/expect.full &&\n'> <'\techo file2:world >non/expect.sub &&\n'> <'\t(\n'> 
          <'\t\tGIT_CEILING_DIRECTORIES="$(pwd)/non" &&\n'> <'\t\texport GIT_CEILING_DIRECTORIES &&\n'> <'\t\tcd non/git &&\n'> 
          <'\t\ttest_must_fail git grep o &&\n'> <'\t\tgit grep --no-index o >../actual.full &&\n'> <'\t\ttest_cmp ../expect.full ../actual.full &&\n'> 
          <'\t\tcd sub &&\n'> <'\t\ttest_must_fail git grep o &&\n'> <'\t\tgit grep --no-index o >../../actual.sub &&\n'> 
          <'\t\ttest_cmp ../../expect.sub ../../actual.sub\n'> <'\t) &&\n'> <'\n'> <'\techo ".*o*" >non/git/.gitignore &&\n'> <'\t(\n'> 
          <'\t\tGIT_CEILING_DIRECTORIES="$(pwd)/non" &&\n'> <'\t\texport GIT_CEILING_DIRECTORIES &&\n'> <'\t\tcd non/git &&\n'> 
          <'\t\ttest_must_fail git grep o &&\n'> <'\t\tgit grep --no-index --exclude-standard o >../actual.full &&\n'> 
          <'\t\ttest_cmp ../expect.full ../actual.full &&\n'> <'\n'> <'\t\t{\n'> <'\t\t\techo ".gitignore:.*o*" &&\n'> <'\t\t\tcat ../expect.full\n'> 
          <'\t\t} >../expect.with.ignored &&\n'> <'\t\tgit grep --no-index --no-exclude o >../actual.full &&\n'> 
          <'\t\ttest_cmp ../expect.with.ignored ../actual.full\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'outside of git repository with fallbackToNoIndex'>)} 
      {
        (SQ <'\n'> <'\trm -fr non &&\n'> <'\tmkdir -p non/git/sub &&\n'> 
          <'\techo hello >non/git/file1 &&\n'> <'\techo world >non/git/sub/file2 &&\n'> <'\tcat <<-\\EOF >non/expect.full &&\n'> <'\tfile1:hello\n'> 
          <'\tsub/file2:world\n'> <'\tEOF\n'> <'\techo file2:world >non/expect.sub &&\n'> <'\t(\n'> 
          <'\t\tGIT_CEILING_DIRECTORIES="$(pwd)/non" &&\n'> <'\t\texport GIT_CEILING_DIRECTORIES &&\n'> <'\t\tcd non/git &&\n'> 
          <'\t\ttest_must_fail git -c grep.fallbackToNoIndex=false grep o &&\n'> <'\t\tgit -c grep.fallbackToNoIndex=true grep o >../actual.full &&\n'> 
          <'\t\ttest_cmp ../expect.full ../actual.full &&\n'> <'\t\tcd sub &&\n'> <'\t\ttest_must_fail git -c grep.fallbackToNoIndex=false grep o &&\n'> 
          <'\t\tgit -c grep.fallbackToNoIndex=true grep o >../../actual.sub &&\n'> <'\t\ttest_cmp ../../expect.sub ../../actual.sub\n'> <'\t) &&\n'> <'\n'> 
          <'\techo ".*o*" >non/git/.gitignore &&\n'> <'\t(\n'> <'\t\tGIT_CEILING_DIRECTORIES="$(pwd)/non" &&\n'> <'\t\texport GIT_CEILING_DIRECTORIES &&\n'> 
          <'\t\tcd non/git &&\n'> <'\t\ttest_must_fail git -c grep.fallbackToNoIndex=false grep o &&\n'> 
          <'\t\tgit -c grep.fallbackToNoIndex=true grep --exclude-standard o >../actual.full &&\n'> <'\t\ttest_cmp ../expect.full ../actual.full &&\n'> <'\n'> <'\t\t{\n'> 
          <'\t\t\techo ".gitignore:.*o*" &&\n'> <'\t\t\tcat ../expect.full\n'> <'\t\t} >../expect.with.ignored &&\n'> 
          <'\t\tgit -c grep.fallbackToNoIndex grep --no-exclude o >../actual.full &&\n'> <'\t\ttest_cmp ../expect.with.ignored ../actual.full\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'inside git repository but with --no-index'>)} 
      {
        (SQ <'\n'> <'\trm -fr is &&\n'> <'\tmkdir -p is/git/sub &&\n'> 
          <'\techo hello >is/git/file1 &&\n'> <'\techo world >is/git/sub/file2 &&\n'> <'\techo ".*o*" >is/git/.gitignore &&\n'> <'\t{\n'> 
          <'\t\techo file1:hello &&\n'> <'\t\techo sub/file2:world\n'> <'\t} >is/expect.unignored &&\n'> <'\t{\n'> 
          <'\t\techo ".gitignore:.*o*" &&\n'> <'\t\tcat is/expect.unignored\n'> <'\t} >is/expect.full &&\n'> <'\t: >is/expect.empty &&\n'> 
          <'\techo file2:world >is/expect.sub &&\n'> <'\t(\n'> <'\t\tcd is/git &&\n'> <'\t\tgit init &&\n'> 
          <'\t\ttest_must_fail git grep o >../actual.full &&\n'> <'\t\ttest_cmp ../expect.empty ../actual.full &&\n'> <'\n'> 
          <'\t\tgit grep --untracked o >../actual.unignored &&\n'> <'\t\ttest_cmp ../expect.unignored ../actual.unignored &&\n'> <'\n'> 
          <'\t\tgit grep --no-index o >../actual.full &&\n'> <'\t\ttest_cmp ../expect.full ../actual.full &&\n'> <'\n'> 
          <'\t\tgit grep --no-index --exclude-standard o >../actual.unignored &&\n'> <'\t\ttest_cmp ../expect.unignored ../actual.unignored &&\n'> <'\n'> <'\t\tcd sub &&\n'> 
          <'\t\ttest_must_fail git grep o >../../actual.sub &&\n'> <'\t\ttest_cmp ../../expect.empty ../../actual.sub &&\n'> <'\n'> 
          <'\t\tgit grep --no-index o >../../actual.sub &&\n'> <'\t\ttest_cmp ../../expect.sub ../../actual.sub &&\n'> <'\n'> 
          <'\t\tgit grep --untracked o >../../actual.sub &&\n'> <'\t\ttest_cmp ../../expect.sub ../../actual.sub\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep --no-index descends into repos, but not .git'>)} 
      {
        (SQ <'\n'> <'\trm -fr non &&\n'> <'\tmkdir -p non/git &&\n'> <'\t(\n'> 
          <'\t\tGIT_CEILING_DIRECTORIES="$(pwd)/non" &&\n'> <'\t\texport GIT_CEILING_DIRECTORIES &&\n'> <'\t\tcd non/git &&\n'> <'\n'> <'\t\techo magic >file &&\n'> 
          <'\t\tgit init repo &&\n'> <'\t\t(\n'> <'\t\t\tcd repo &&\n'> <'\t\t\techo magic >file &&\n'> <'\t\t\tgit add file &&\n'> 
          <'\t\t\tgit commit -m foo &&\n'> <'\t\t\techo magic >.git/file\n'> <'\t\t) &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\t\tfile\n'> 
          <'\t\trepo/file\n'> <'\t\tEOF\n'> <'\t\tgit grep -l --no-index magic >actual &&\n'> <'\t\ttest_cmp expect actual\n'> 
          <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'setup double-dash tests'>)} 
      {
        (SQ <'\n'> <'cat >double-dash <<EOF &&\n'> <'--\n'> <'->\n'> <'other\n'> <'EOF\n'> 
          <'git add double-dash\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2006])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('double-dash:->\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2009]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -- pattern'>)} 
      {(SQ <'\n'> <'\tgit grep -- "->" >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep -- pattern -- pathspec'>)} 
      {
        (SQ <'\n'> <'\tgit grep -- "->" -- double-dash >actual &&\n'> <'\ttest_cmp expected actual\n'>)
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -e pattern -- path'>)} 
      {
        (SQ <'\n'> <'\tgit grep -e "->" -- double-dash >actual &&\n'> <'\ttest_cmp expected actual\n'>)
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2053])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ('double-dash:--\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2056]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep -e -- -- path'>)} 
      {(SQ <'\n'> <'\tgit grep -e -- -- double-dash >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2076])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c:int main(int argc, const char **argv)\n') ('hello.c:\tprintf(') 
                (Right_DoubleQuote '"') ('Hello world.') (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) (Right_DoubleQuote '"') (');\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2079]
        )
      ]
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep --perl-regexp pattern'>)} 
      {
        (SQ <'\n'> <'\tgit grep --perl-regexp "\\p{Ps}.*?\\p{Pe}" hello.c >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P pattern'>)} 
      {
        (SQ <'\n'> <'\tgit grep -P "\\p{Ps}.*?\\p{Pe}" hello.c >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep pattern with grep.extendedRegexp=true'>)} 
      {
        (SQ <'\n'> <'\t>empty &&\n'> <'\ttest_must_fail git -c grep.extendedregexp=true \\\n'> 
          <'\t\tgrep "\\p{Ps}.*?\\p{Pe}" hello.c >actual &&\n'> <'\ttest_cmp empty actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P pattern with grep.extendedRegexp=true'>)} 
      {
        (SQ <'\n'> <'\tgit -c grep.extendedregexp=true \\\n'> 
          <'\t\tgrep -P "\\p{Ps}.*?\\p{Pe}" hello.c >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P -v pattern'>)} 
      {
        (SQ <'\n'> <'\t{\n'> <'\t\techo "ab:a+b*c"\n'> <'\t\techo "ab:a+bc"\n'> <'\t} >expected &&\n'> 
          <'\tgit grep -P -v "abc" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P -i pattern'>)} 
      {
        (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\thello.c:\tprintf("Hello world.\\n");\n'> 
          <'\tEOF\n'> <'\tgit grep -P -i "PRINTF\\([^\\d]+\\)" hello.c >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P -w pattern'>)} 
      {
        (SQ <'\n'> <'\t{\n'> <'\t\techo "hello_world:Hello world"\n'> 
          <'\t\techo "hello_world:HeLLo world"\n'> <'\t} >expected &&\n'> <'\tgit grep -P -w "He((?i)ll)o" hello_world >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -G invalidpattern properly dies '>)} 
      {(SQ <'\n'> <'\ttest_must_fail git grep -G "a["\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep invalidpattern properly dies with grep.patternType=basic'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git -c grep.patterntype=basic grep "a["\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep -E invalidpattern properly dies '>)} 
      {(SQ <'\n'> <'\ttest_must_fail git grep -E "a["\n'>)}
    )
    (C {(test_expect_success)} 
      {(SQ <'grep invalidpattern properly dies with grep.patternType=extended'>)} {(SQ <'\n'> <'\ttest_must_fail git -c grep.patterntype=extended grep "a["\n'>)}
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P invalidpattern properly dies '>)} 
      {(SQ <'\n'> <'\ttest_must_fail git grep -P "a["\n'>)}
    )
    (C {(test_expect_success)} {(LIBPCRE)} 
      {(SQ <'grep invalidpattern properly dies with grep.patternType=perl'>)} {(SQ <'\n'> <'\ttest_must_fail git -c grep.patterntype=perl grep "a["\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'grep -G -E -F pattern'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+b*c" >expected &&\n'> <'\tgit grep -G -E -F "a+b*c" ab >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep pattern with grep.patternType=basic, =extended, =fixed'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+b*c" >expected &&\n'> <'\tgit \\\n'> 
          <'\t\t-c grep.patterntype=basic \\\n'> <'\t\t-c grep.patterntype=extended \\\n'> <'\t\t-c grep.patterntype=fixed \\\n'> 
          <'\t\tgrep "a+b*c" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -E -F -G pattern'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+bc" >expected &&\n'> <'\tgit grep -E -F -G "a+b*c" ab >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep pattern with grep.patternType=extended, =fixed, =basic'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+bc" >expected &&\n'> <'\tgit \\\n'> 
          <'\t\t-c grep.patterntype=extended \\\n'> <'\t\t-c grep.patterntype=fixed \\\n'> <'\t\t-c grep.patterntype=basic \\\n'> 
          <'\t\tgrep "a+b*c" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -F -G -E pattern'>)} 
      {
        (SQ <'\n'> <'\techo "ab:abc" >expected &&\n'> <'\tgit grep -F -G -E "a+b*c" ab >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep pattern with grep.patternType=fixed, =basic, =extended'>)} 
      {
        (SQ <'\n'> <'\techo "ab:abc" >expected &&\n'> <'\tgit \\\n'> 
          <'\t\t-c grep.patterntype=fixed \\\n'> <'\t\t-c grep.patterntype=basic \\\n'> <'\t\t-c grep.patterntype=extended \\\n'> 
          <'\t\tgrep "a+b*c" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -G -F -P -E pattern'>)} 
      {
        (SQ <'\n'> <'\t>empty &&\n'> 
          <'\ttest_must_fail git grep -G -F -P -E "a\\x{2b}b\\x{2a}c" ab >actual &&\n'> <'\ttest_cmp empty actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'grep pattern with grep.patternType=fixed, =basic, =perl, =extended'>)} 
      {
        (SQ <'\n'> <'\t>empty &&\n'> <'\ttest_must_fail git \\\n'> 
          <'\t\t-c grep.patterntype=fixed \\\n'> <'\t\t-c grep.patterntype=basic \\\n'> <'\t\t-c grep.patterntype=perl \\\n'> 
          <'\t\t-c grep.patterntype=extended \\\n'> <'\t\tgrep "a\\x{2b}b\\x{2a}c" ab >actual &&\n'> <'\ttest_cmp empty actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -G -F -E -P pattern'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+b*c" >expected &&\n'> 
          <'\tgit grep -G -F -E -P "a\\x{2b}b\\x{2a}c" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} 
      {(SQ <'grep pattern with grep.patternType=fixed, =basic, =extended, =perl'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+b*c" >expected &&\n'> <'\tgit \\\n'> 
          <'\t\t-c grep.patterntype=fixed \\\n'> <'\t\t-c grep.patterntype=basic \\\n'> <'\t\t-c grep.patterntype=extended \\\n'> 
          <'\t\t-c grep.patterntype=perl \\\n'> <'\t\tgrep "a\\x{2b}b\\x{2a}c" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P pattern with grep.patternType=fixed'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+b*c" >expected &&\n'> <'\tgit \\\n'> 
          <'\t\t-c grep.patterntype=fixed \\\n'> <'\t\tgrep -P "a\\x{2b}b\\x{2a}c" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -F pattern with grep.patternType=basic'>)} 
      {
        (SQ <'\n'> <'\techo "ab:a+b*c" >expected &&\n'> <'\tgit \\\n'> 
          <'\t\t-c grep.patterntype=basic \\\n'> <'\t\tgrep -F "*c" ab >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -G pattern with grep.patternType=fixed'>)} 
      {
        (SQ <'\n'> <'\t{\n'> <'\t\techo "ab:a+b*c"\n'> <'\t\techo "ab:a+bc"\n'> <'\t} >expected &&\n'> 
          <'\tgit \\\n'> <'\t\t-c grep.patterntype=fixed \\\n'> <'\t\tgrep -G "a+b" ab >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep -E pattern with grep.patternType=fixed'>)} 
      {
        (SQ <'\n'> <'\t{\n'> <'\t\techo "ab:a+b*c"\n'> <'\t\techo "ab:a+bc"\n'> <'\t\techo "ab:abc"\n'> 
          <'\t} >expected &&\n'> <'\tgit \\\n'> <'\t\t-c grep.patterntype=fixed \\\n'> <'\t\tgrep -E "a+" ab >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2525])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c<RED>:<RESET>int main(int argc, const char **argv)\n') 
                ('hello.c<RED>-<RESET>{\n') ('<RED>--<RESET>\n') ('hello.c<RED>:<RESET>\t/* char ?? */\n') ('hello.c<RED>-<RESET>}\n') 
                ('<RED>--<RESET>\n') ('hello_world<RED>:<RESET>Hello_world\n') ('hello_world<RED>-<RESET>HeLLo_world\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2528]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --color, separator'>)} 
      {
        (SQ <'\n'> <'\ttest_config color.grep.context\t\tnormal &&\n'> 
          <'\ttest_config color.grep.filename\t\tnormal &&\n'> <'\ttest_config color.grep.function\t\tnormal &&\n'> 
          <'\ttest_config color.grep.linenumber\tnormal &&\n'> <'\ttest_config color.grep.match\t\tnormal &&\n'> <'\ttest_config color.grep.selected\t\tnormal &&\n'> 
          <'\ttest_config color.grep.separator\tred &&\n'> <'\n'> <'\tgit grep --color=always -A1 -e char -e lo_w hello.c hello_world |\n'> 
          <'\ttest_decode_color >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2565])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c:int main(int argc, const char **argv)\n') ('hello.c:\t/* char ?? */\n') 
                ('\n') ('hello_world:Hello_world\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2568]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --break'>)} 
      {
        (SQ <'\n'> <'\tgit grep --break -e char -e lo_w hello.c hello_world >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2592])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c:int main(int argc, const char **argv)\n') ('hello.c-{\n') ('--\n') 
                ('hello.c:\t/* char ?? */\n') ('hello.c-}\n') ('\n') ('hello_world:Hello_world\n') ('hello_world-HeLLo_world\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2595]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --break with context'>)} 
      {
        (SQ <'\n'> <'\tgit grep --break -A1 -e char -e lo_w hello.c hello_world >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2623])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c\n') ('int main(int argc, const char **argv)\n') ('\t/* char ?? */\n') 
                ('hello_world\n') ('Hello_world\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2626]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --heading'>)} 
      {
        (SQ <'\n'> <'\tgit grep --heading -e char -e lo_w hello.c hello_world >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2651])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('<BOLD;GREEN>hello.c<RESET>\n') 
                ('4:int main(int argc, const <BLACK;BYELLOW>char<RESET> **argv)\n') ('8:\t/* <BLACK;BYELLOW>char<RESET> ?? */\n') ('\n') ('<BOLD;GREEN>hello_world<RESET>\n') 
                ('3:Hel<BLACK;BYELLOW>lo_w<RESET>orld\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2654]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'mimic ack-grep --group'>)} 
      {
        (SQ <'\n'> <'\ttest_config color.grep.context\t\tnormal &&\n'> 
          <'\ttest_config color.grep.filename\t\t"bold green" &&\n'> <'\ttest_config color.grep.function\t\tnormal &&\n'> 
          <'\ttest_config color.grep.linenumber\tnormal &&\n'> <'\ttest_config color.grep.match\t\t"black yellow" &&\n'> 
          <'\ttest_config color.grep.selected\t\tnormal &&\n'> <'\ttest_config color.grep.separator\tnormal &&\n'> <'\n'> 
          <'\tgit grep --break --heading -n --color \\\n'> <'\t\t-e char -e lo_w hello.c hello_world |\n'> <'\ttest_decode_color >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2690])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('space: line with leading space1\n') ('space: line with leading space2\n') 
                ('space: line with leading space3\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2693]
        )
      ]
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -E "^ "'>)} 
      {(SQ <'\n'> <'\tgit grep -E "^ " space >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (C {(test_expect_success)} {(LIBPCRE)} {(SQ <'grep -P "^ "'>)} 
      {(SQ <'\n'> <'\tgit grep -P "^ " space >actual &&\n'> <'\ttest_cmp expected actual\n'>)}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2733])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('space-line without leading space1\n') 
                ('space: line <RED>with <RESET>leading space1\n') ('space: line <RED>with <RESET>leading <RED>space2<RESET>\n') 
                ('space: line <RED>with <RESET>leading space3\n') ('space:line without leading <RED>space2<RESET>\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2736]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --color -e A -e B with context'>)} 
      {
        (SQ <'\n'> <'\ttest_config color.grep.context\t\tnormal &&\n'> 
          <'\ttest_config color.grep.filename\t\tnormal &&\n'> <'\ttest_config color.grep.function\t\tnormal &&\n'> 
          <'\ttest_config color.grep.linenumber\tnormal &&\n'> <'\ttest_config color.grep.matchContext\tnormal &&\n'> 
          <'\ttest_config color.grep.matchSelected\tred &&\n'> <'\ttest_config color.grep.selected\t\tnormal &&\n'> 
          <'\ttest_config color.grep.separator\tnormal &&\n'> <'\n'> <'\tgit grep --color=always -C2 -e "with " -e space2  space |\n'> 
          <'\ttest_decode_color >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2771])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('space-line without leading space1\n') ('space- line with leading space1\n') 
                ('space: line <RED>with <RESET>leading <RED>space2<RESET>\n') ('space- line with leading space3\n') ('space-line without leading space2\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2774]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --color -e A --and -e B with context'>)} 
      {
        (SQ <'\n'> <'\ttest_config color.grep.context\t\tnormal &&\n'> 
          <'\ttest_config color.grep.filename\t\tnormal &&\n'> <'\ttest_config color.grep.function\t\tnormal &&\n'> 
          <'\ttest_config color.grep.linenumber\tnormal &&\n'> <'\ttest_config color.grep.matchContext\tnormal &&\n'> 
          <'\ttest_config color.grep.matchSelected\tred &&\n'> <'\ttest_config color.grep.selected\t\tnormal &&\n'> 
          <'\ttest_config color.grep.separator\tnormal &&\n'> <'\n'> <'\tgit grep --color=always -C2 -e "with " --and -e space2  space |\n'> 
          <'\ttest_decode_color >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2809])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('space-line without leading space1\n') 
                ('space: line <RED>with <RESET>leading space1\n') ('space- line with leading space2\n') ('space: line <RED>with <RESET>leading space3\n') 
                ('space-line without leading space2\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2812]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --color -e A --and --not -e B with context'>)} 
      {
        (SQ <'\n'> <'\ttest_config color.grep.context\t\tnormal &&\n'> 
          <'\ttest_config color.grep.filename\t\tnormal &&\n'> <'\ttest_config color.grep.function\t\tnormal &&\n'> 
          <'\ttest_config color.grep.linenumber\tnormal &&\n'> <'\ttest_config color.grep.matchContext\tnormal &&\n'> 
          <'\ttest_config color.grep.matchSelected\tred &&\n'> <'\ttest_config color.grep.selected\t\tnormal &&\n'> 
          <'\ttest_config color.grep.separator\tnormal &&\n'> <'\n'> <'\tgit grep --color=always -C2 -e "with " --and --not -e space2  space |\n'> 
          <'\ttest_decode_color >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[2847])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ('hello.c-\n') ('hello.c=int main(int argc, const char **argv)\n') ('hello.c-{\n') 
                ('hello.c:\tpr<RED>int<RESET>f(') (Right_DoubleQuote '"') ('<RED>Hello<RESET> world.') (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) 
                (Right_DoubleQuote '"') (');\n') ('hello.c-\treturn 0;\n') ('hello.c-\t/* char ?? */\n') ('hello.c-}\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [2850]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'grep --color -e A --and -e B -p with context'>)} 
      {
        (SQ <'\n'> <'\ttest_config color.grep.context\t\tnormal &&\n'> 
          <'\ttest_config color.grep.filename\t\tnormal &&\n'> <'\ttest_config color.grep.function\t\tnormal &&\n'> 
          <'\ttest_config color.grep.linenumber\tnormal &&\n'> <'\ttest_config color.grep.matchContext\tnormal &&\n'> 
          <'\ttest_config color.grep.matchSelected\tred &&\n'> <'\ttest_config color.grep.selected\t\tnormal &&\n'> 
          <'\ttest_config color.grep.separator\tnormal &&\n'> <'\n'> <'\tgit grep --color=always -p -C3 -e int --and -e Hello --no-index hello.c |\n'> 
          <'\ttest_decode_color >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep can find things only in the work tree'>)} 
      {
        (SQ <'\n'> <'\t: >work-tree-only &&\n'> <'\tgit add work-tree-only &&\n'> 
          <'\ttest_when_finished "git rm -f work-tree-only" &&\n'> <'\techo "find in work tree" >work-tree-only &&\n'> <'\tgit grep --quiet "find in work tree" &&\n'> 
          <'\ttest_must_fail git grep --quiet --cached "find in work tree" &&\n'> <'\ttest_must_fail git grep --quiet "find in work tree" HEAD\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep can find things only in the work tree (i-t-a)'>)} 
      {
        (SQ <'\n'> <'\techo "intend to add this" >intend-to-add &&\n'> 
          <'\tgit add -N intend-to-add &&\n'> <'\ttest_when_finished "git rm -f intend-to-add" &&\n'> 
          <'\tgit grep --quiet "intend to add this" &&\n'> <'\ttest_must_fail git grep --quiet --cached "intend to add this" &&\n'> 
          <'\ttest_must_fail git grep --quiet "intend to add this" HEAD\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep does not search work tree with assume unchanged'>)} 
      {
        (SQ <'\n'> <'\techo "intend to add this" >intend-to-add &&\n'> 
          <'\tgit add -N intend-to-add &&\n'> <'\tgit update-index --assume-unchanged intend-to-add &&\n'> 
          <'\ttest_when_finished "git rm -f intend-to-add" &&\n'> <'\ttest_must_fail git grep --quiet "intend to add this" &&\n'> 
          <'\ttest_must_fail git grep --quiet --cached "intend to add this" &&\n'> <'\ttest_must_fail git grep --quiet "intend to add this" HEAD\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep can find things only in the index'>)} 
      {
        (SQ <'\n'> <'\techo "only in the index" >cache-this &&\n'> <'\tgit add cache-this &&\n'> 
          <'\trm cache-this &&\n'> <'\ttest_when_finished "git rm --cached cache-this" &&\n'> 
          <'\ttest_must_fail git grep --quiet "only in the index" &&\n'> <'\tgit grep --quiet --cached "only in the index" &&\n'> 
          <'\ttest_must_fail git grep --quiet "only in the index" HEAD\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep does not report i-t-a with -L --cached'>)} 
      {
        (SQ <'\n'> <'\techo "intend to add this" >intend-to-add &&\n'> 
          <'\tgit add -N intend-to-add &&\n'> <'\ttest_when_finished "git rm -f intend-to-add" &&\n'> 
          <'\tgit ls-files | grep -v "^intend-to-add\\$" >expected &&\n'> <'\tgit grep -L --cached "nonexistent_string" >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'grep does not report i-t-a and assume unchanged with -L'>)} 
      {
        (SQ <'\n'> <'\techo "intend to add this" >intend-to-add-assume-unchanged &&\n'> 
          <'\tgit add -N intend-to-add-assume-unchanged &&\n'> <'\ttest_when_finished "git rm -f intend-to-add-assume-unchanged" &&\n'> 
          <'\tgit update-index --assume-unchanged intend-to-add-assume-unchanged &&\n'> <'\tgit ls-files | grep -v "^intend-to-add-assume-unchanged\\$" >expected &&\n'> 
          <'\tgit grep -L "nonexistent_string" >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)