(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'rewrite diff on binary file'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: make_file
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<printf>} {(DQ <'='> <Id.Lit_Other '\\'> <n>)}]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file>})]
              do_fork: T
            )
            (command.ForEach
              iter_name: i
              iter_words: [{<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>} {<10>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.ForEach
                      iter_name: j
                      iter_words: [{<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>}]
                      do_arg_iter: F
                      body: 
                        (command.DoGroup
                          children: [
                            (command.ForEach
                              iter_name: k
                              iter_words: [{<1>} {<2>} {<3>} {<4>} {<5>}]
                              do_arg_iter: F
                              body: 
                                (command.DoGroup
                                  children: [
                                    (C {<printf>} {(DQ ($ Id.VSub_Number '$1') <Id.Lit_Other '\\'> <n>)})
                                  ]
                                )
                            )
                          ]
                        )
                    )
                  ]
                )
              redirects: [(redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<file>})]
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'create binary file with changes'>)} 
      {(SQ <'\n'> <'\tmake_file "\\\\0" &&\n'> <'\tgit add file &&\n'> <'\tmake_file "\\\\01"\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'vanilla diff is binary'>)} 
      {
        (SQ <'\n'> <'\tgit diff >diff &&\n'> <'\tgrep "Binary files a/file and b/file differ" diff\n'>)
      }
    )
    (C {<test_expect_success>} {(SQ <'rewrite diff is binary'>)} 
      {
        (SQ <'\n'> <'\tgit diff -B >diff &&\n'> <'\tgrep "dissimilarity index" diff &&\n'> 
          <'\tgrep "Binary files a/file and b/file differ" diff\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rewrite diff can show binary patch'>)} 
      {
        (SQ <'\n'> <'\tgit diff -B --binary >diff &&\n'> <'\tgrep "dissimilarity index" diff &&\n'> 
          <'\tgrep "GIT binary patch" diff\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rewrite diff --numstat shows binary changes'>)} 
      {
        (SQ <'\n'> <'\tgit diff -B --numstat --summary >diff &&\n'> <'\tgrep -e "-\t-\t" diff &&\n'> 
          <'\tgrep " rewrite file" diff\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff --stat counts binary rewrite as 0 lines'>)} 
      {
        (SQ <'\n'> <'\tgit diff -B --stat --summary >diff &&\n'> <'\tgrep "Bin" diff &&\n'> 
          <'\ttest_i18ngrep "0 insertions.*0 deletions" diff &&\n'> <'\tgrep " rewrite file" diff\n'>
        )
      }
    )
    (BraceGroup
      children: [
        (C {<echo>} {(DQ <'#!'> ($ Id.VSub_DollarName '$SHELL_PATH'))})
        (command.Simple
          words: [{<cat>}]
          redirects: [
            (redir
              op: <Id.Redir_DLess '<<'>
              loc: (redir_loc.Fd fd:0)
              arg: 
                (redir_param.MultiLine
                  here_begin: {(SQ <EOF>)}
                  here_end_span_id: 248
                  stdin_parts: [
                    <'"$PERL_PATH" -e \'$/ = undef; $_ = <>; s/./ord($&)/ge; print $_\' < "$1"\n'>
                  ]
                )
            )
          ]
          do_fork: T
        )
      ]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<dump>})]
    )
    (C {<chmod>} {<Id.Lit_Other '+'> <x>} {<dump>})
    (C {<test_expect_success>} {(SQ <'setup textconv'>)} 
      {
        (SQ <'\n'> <'\techo file diff=foo >.gitattributes &&\n'> 
          <'\tgit config diff.foo.textconv "\\"$(pwd)\\""/dump\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rewrite diff respects textconv'>)} 
      {
        (SQ <'\n'> <'\tgit diff -B >diff &&\n'> <'\tgrep "dissimilarity index" diff &&\n'> 
          <'\tgrep "^-61" diff &&\n'> <'\tgrep "^-0" diff\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)