(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ (Token id:Id.Lit_Chars val:'Binary diff and apply\n' span_id:15))}
          spids: [13]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:26)
          fd: -1
          arg_word: {(expect.binary-numstat)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:29)
          fd: -1
          here_begin: 
            {(word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\E' span_id:30)) (OF)}
          here_end_span_id: 37
          stdin_parts: [('1\t1\ta\n') ('-\t-\tb\n') ('1\t1\tc\n') ('-\t-\td\n')]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'prepare repository' span_id:42))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:46) 
          (Token
            id: Id.Lit_Chars
            val: '\techo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&\n'
            span_id: 47
          ) (Token id:Id.Lit_Chars val:'\tgit update-index --add a b c d &&\n' span_id:48) 
          (Token id:Id.Lit_Chars val:'\techo git >a &&\n' span_id:49) (Token id:Id.Lit_Chars val:'\tcat "$TEST_DIRECTORY"/test-binary-1.png >b &&\n' span_id:50) 
          (Token id:Id.Lit_Chars val:'\techo git >c &&\n' span_id:51) (Token id:Id.Lit_Chars val:'\tcat b b >d\n' span_id:52)
        )
      }
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:58)
          fd: -1
          arg_word: {(expected)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:62)
          fd: -1
          here_begin: 
            {(word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\E' span_id:63)) (OF)}
          here_end_span_id: 71
          stdin_parts: [
            (' a |    2 +-\n')
            (' b |  Bin\n')
            (' c |    2 +-\n')
            (' d |  Bin\n')
            (' 4 files changed, 2 insertions(+), 2 deletions(-)\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply --stat output for binary file change' span_id:75))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:79) 
          (Token id:Id.Lit_Chars val:'\tgit diff >diff &&\n' span_id:80) (Token id:Id.Lit_Chars val:'\tgit apply --stat --summary <diff >current &&\n' span_id:81) 
          (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expected current\n' span_id:82)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'diff --shortstat output for binary file change' span_id:89))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:93) 
          (Token id:Id.Lit_Chars val:'\ttail -n 1 expected >expect &&\n' span_id:94) (Token id:Id.Lit_Chars val:'\tgit diff --shortstat >current &&\n' span_id:95) 
          (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect current\n' span_id:96)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'diff --shortstat output for binary file change only'
            span_id: 103
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:107) 
          (Token
            id: Id.Lit_Chars
            val: '\techo " 1 file changed, 0 insertions(+), 0 deletions(-)" >expected &&\n'
            span_id: 108
          ) (Token id:Id.Lit_Chars val:'\tgit diff --shortstat -- b >current &&\n' span_id:109) 
          (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expected current\n' span_id:110)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply --numstat notices binary file change' span_id:117))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:121) 
          (Token id:Id.Lit_Chars val:'\tgit diff >diff &&\n' span_id:122) (Token id:Id.Lit_Chars val:'\tgit apply --numstat <diff >current &&\n' span_id:123) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_cmp expect.binary-numstat current\n'
            span_id: 124
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'apply --numstat understands diff --binary format'
            span_id: 131
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:135) 
          (Token id:Id.Lit_Chars val:'\tgit diff --binary >diff &&\n' span_id:136) (Token id:Id.Lit_Chars val:'\tgit apply --numstat <diff >current &&\n' span_id:137) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_cmp expect.binary-numstat current\n'
            span_id: 138
          )
        )
      }
    )
    (C {(test_expect_success)} {(C_LOCALE_OUTPUT)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply detecting corrupt patch correctly' span_id:153))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:157) 
          (Token id:Id.Lit_Chars val:'\tgit diff >output &&\n' span_id:158) (Token id:Id.Lit_Chars val:'\tsed -e "s/-CIT/xCIT/" <output >broken &&\n' span_id:159) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git apply --stat --summary broken 2>detected &&\n'
            span_id: 160
          ) (Token id:Id.Lit_Chars val:'\tdetected=$(cat detected) &&\n' span_id:161) 
          (Token
            id: Id.Lit_Chars
            val: '\tdetected=$(expr "$detected" : "error.*at line \\\\([0-9]*\\\\)\\$") &&\n'
            span_id: 162
          ) (Token id:Id.Lit_Chars val:'\tdetected=$(sed -ne "${detected}p" broken) &&\n' span_id:163) 
          (Token id:Id.Lit_Chars val:'\ttest "$detected" = xCIT\n' span_id:164)
        )
      }
    )
    (C {(test_expect_success)} {(C_LOCALE_OUTPUT)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply detecting corrupt patch correctly' span_id:173))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:177) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit diff --binary | sed -e "s/-CIT/xCIT/" >broken &&\n'
            span_id: 178
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git apply --stat --summary broken 2>detected &&\n'
            span_id: 179
          ) (Token id:Id.Lit_Chars val:'\tdetected=$(cat detected) &&\n' span_id:180) 
          (Token
            id: Id.Lit_Chars
            val: '\tdetected=$(expr "$detected" : "error.*at line \\\\([0-9]*\\\\)\\$") &&\n'
            span_id: 181
          ) (Token id:Id.Lit_Chars val:'\tdetected=$(sed -ne "${detected}p" broken) &&\n' span_id:182) 
          (Token id:Id.Lit_Chars val:'\ttest "$detected" = xCIT\n' span_id:183)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'initial commit' span_id:190))} 
      {(SQ (Token id:Id.Lit_Chars val:'git commit -a -m initial' span_id:194))}
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'diff-index with --binary' span_id:204))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:208) 
          (Token
            id: Id.Lit_Chars
            val: '\techo AIT >a && mv b e && echo CIT >c && cat e >d &&\n'
            span_id: 209
          ) (Token id:Id.Lit_Chars val:'\tgit update-index --add --remove a b c d e &&\n' span_id:210) 
          (Token id:Id.Lit_Chars val:'\ttree0=$(git write-tree) &&\n' span_id:211) (Token id:Id.Lit_Chars val:'\tgit diff --cached --binary >current &&\n' span_id:212) 
          (Token id:Id.Lit_Chars val:'\tgit apply --stat --summary current\n' span_id:213)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply binary patch' span_id:220))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:224) 
          (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:225) (Token id:Id.Lit_Chars val:'\tgit apply --binary --index <current &&\n' span_id:226) 
          (Token id:Id.Lit_Chars val:'\ttree1=$(git write-tree) &&\n' span_id:227) (Token id:Id.Lit_Chars val:'\ttest "$tree1" = "$tree0"\n' span_id:228)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'diff --no-index with binary creation' span_id:235))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:239) 
          (Token id:Id.Lit_Chars val:'\techo Q | q_to_nul >binary &&\n' span_id:240) 
          (Token
            id: Id.Lit_Chars
            val: '\t(: hide error code from diff, which just indicates differences\n'
            span_id: 241
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\t git diff --binary --no-index /dev/null binary >current ||\n'
            span_id: 242
          ) (Token id:Id.Lit_Chars val:'\t true\n' span_id:243) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:244) 
          (Token id:Id.Lit_Chars val:'\trm binary &&\n' span_id:245) (Token id:Id.Lit_Chars val:'\tgit apply --binary <current &&\n' span_id:246) 
          (Token id:Id.Lit_Chars val:'\techo Q >expected &&\n' span_id:247) (Token id:Id.Lit_Chars val:'\tnul_to_q <binary >actual &&\n' span_id:248) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expected actual\n' span_id:249)
        )
      }
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:255)
          fd: -1
          arg_word: {(expect)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:258)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 264
          stdin_parts: [
            (' binfile  |   Bin 0 -> 1026 bytes\n')
            (' textfile | 10000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'diff --stat with binary files and big change count'
            span_id: 269
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:273) 
          (Token
            id: Id.Lit_Chars
            val: '\tprintf "\\01\\00%1024d" 1 >binfile &&\n'
            span_id: 274
          ) (Token id:Id.Lit_Chars val:'\tgit add binfile &&\n' span_id:275) 
          (Token id:Id.Lit_Chars val:'\ti=0 &&\n' span_id:276) (Token id:Id.Lit_Chars val:'\twhile test $i -lt 10000; do\n' span_id:277) 
          (Token id:Id.Lit_Chars val:'\t\techo $i &&\n' span_id:278) (Token id:Id.Lit_Chars val:'\t\ti=$(($i + 1))\n' span_id:279) 
          (Token id:Id.Lit_Chars val:'\tdone >textfile &&\n' span_id:280) (Token id:Id.Lit_Chars val:'\tgit add textfile &&\n' span_id:281) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit diff --cached --stat binfile textfile >output &&\n'
            span_id: 282
          ) (Token id:Id.Lit_Chars val:'\tgrep " | " output >actual &&\n' span_id:283) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:284)
        )
      }
    )
    (C {(test_done)})
  ]
)