(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:'git apply handling binary patches\n' span_id:15) 
                (Token id:Id.Lit_Chars val:'\n' span_id:16)
              )
            }
          spids: [13]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:27))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:31) 
          (Token id:Id.Lit_Chars val:'\tcat >file1 <<-\\EOF &&\n' span_id:32) (Token id:Id.Lit_Chars val:'\tA quick brown fox jumps over the lazy dog.\n' span_id:33) 
          (Token
            id: Id.Lit_Chars
            val: '\tA tiny little penguin runs around in circles.\n'
            span_id: 34
          ) (Token id:Id.Lit_Chars val:'\tThere is a flag with Linux written on it.\n' span_id:35) 
          (Token
            id: Id.Lit_Chars
            val: '\tA slow black-and-white panda just sits there,\n'
            span_id: 36
          ) (Token id:Id.Lit_Chars val:'\tmunching on his bamboo.\n' span_id:37) 
          (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:38) (Token id:Id.Lit_Chars val:'\tcat file1 >file2 &&\n' span_id:39) 
          (Token id:Id.Lit_Chars val:'\tcat file1 >file4 &&\n' span_id:40) (Token id:Id.Lit_Chars val:'\n' span_id:41) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit update-index --add --remove file1 file2 file4 &&\n'
            span_id: 42
          ) (Token id:Id.Lit_Chars val:'\tgit commit -m "Initial Version" 2>/dev/null &&\n' span_id:43) 
          (Token id:Id.Lit_Chars val:'\n' span_id:44) (Token id:Id.Lit_Chars val:'\tgit checkout -b binary &&\n' span_id:45) 
          (Token
            id: Id.Lit_Chars
            val: '\tperl -pe "y/x/\\000/" <file1 >file3 &&\n'
            span_id: 46
          ) (Token id:Id.Lit_Chars val:'\tcat file3 >file4 &&\n' span_id:47) 
          (Token id:Id.Lit_Chars val:'\tgit add file2 &&\n' span_id:48) (Token id:Id.Lit_Chars val:'\tperl -pe "y/\\000/v/" <file3 >file1 &&\n' span_id:49) 
          (Token id:Id.Lit_Chars val:'\trm -f file2 &&\n' span_id:50) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit update-index --add --remove file1 file2 file3 file4 &&\n'
            span_id: 51
          ) (Token id:Id.Lit_Chars val:'\tgit commit -m "Second Version" &&\n' span_id:52) 
          (Token id:Id.Lit_Chars val:'\n' span_id:53) (Token id:Id.Lit_Chars val:'\tgit diff-tree -p master binary >B.diff &&\n' span_id:54) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit diff-tree -p -C master binary >C.diff &&\n'
            span_id: 55
          ) (Token id:Id.Lit_Chars val:'\n' span_id:56) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit diff-tree -p --binary master binary >BF.diff &&\n'
            span_id: 57
          ) (Token id:Id.Lit_Chars val:'\tgit diff-tree -p --binary -C master binary >CF.diff &&\n' span_id:58) 
          (Token id:Id.Lit_Chars val:'\n' span_id:59) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit diff-tree -p --full-index master binary >B-index.diff &&\n'
            span_id: 60
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit diff-tree -p -C --full-index master binary >C-index.diff &&\n'
            span_id: 61
          ) (Token id:Id.Lit_Chars val:'\n' span_id:62) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit diff-tree -p --binary --no-prefix master binary -- file3 >B0.diff &&\n'
            span_id: 63
          ) (Token id:Id.Lit_Chars val:'\n' span_id:64) 
          (Token id:Id.Lit_Chars val:'\tgit init other-repo &&\n' span_id:65) (Token id:Id.Lit_Chars val:'\t(\n' span_id:66) 
          (Token id:Id.Lit_Chars val:'\t\tcd other-repo &&\n' span_id:67) (Token id:Id.Lit_Chars val:'\t\tgit fetch .. master &&\n' span_id:68) 
          (Token id:Id.Lit_Chars val:'\t\tgit reset --hard FETCH_HEAD\n' span_id:69) (Token id:Id.Lit_Chars val:'\t)\n' span_id:70)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'stat binary diff -- should not fail.' span_id:77))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'git checkout master &&\n' span_id:83) 
          (Token id:Id.Lit_Chars val:'\t git apply --stat --summary B.diff' span_id:84)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'stat binary -p0 diff -- should not fail.' span_id:91))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:95) 
          (Token id:Id.Lit_Chars val:'\t git checkout master &&\n' span_id:96) (Token id:Id.Lit_Chars val:'\t git apply --stat -p0 B0.diff\n' span_id:97)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'stat binary diff (copy) -- should not fail.' span_id:104))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'git checkout master &&\n' span_id:110) 
          (Token id:Id.Lit_Chars val:'\t git apply --stat --summary C.diff' span_id:111)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'check binary diff -- should fail.' span_id:118))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'git checkout master &&\n' span_id:124) 
          (Token
            id: Id.Lit_Chars
            val: '\t test_must_fail git apply --check B.diff'
            span_id: 125
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'check binary diff (copy) -- should fail.' span_id:132))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'git checkout master &&\n' span_id:138) 
          (Token
            id: Id.Lit_Chars
            val: '\t test_must_fail git apply --check C.diff'
            span_id: 139
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'check incomplete binary diff with replacement -- should fail.'
            span_id: 148
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:152) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:153) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git apply --check --allow-binary-replacement B.diff\n'
            span_id: 154
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'check incomplete binary diff with replacement (copy) -- should fail.'
            span_id: 163
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:167) 
          (Token id:Id.Lit_Chars val:'\t git checkout master &&\n' span_id:168) 
          (Token
            id: Id.Lit_Chars
            val: '\t test_must_fail git apply --check --allow-binary-replacement C.diff\n'
            span_id: 169
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'check binary diff with replacement.' span_id:176))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'git checkout master &&\n' span_id:182) 
          (Token
            id: Id.Lit_Chars
            val: '\t git apply --check --allow-binary-replacement BF.diff'
            span_id: 183
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'check binary diff with replacement (copy).' span_id:190))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'git checkout master &&\n' span_id:196) 
          (Token
            id: Id.Lit_Chars
            val: '\t git apply --check --allow-binary-replacement CF.diff'
            span_id: 197
          )
        )
      }
    )
    (command.ShFunction
      name: do_reset
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(rm)} {(-f)} {(file) (Id.Lit_QMark '?')})
                (C {(git)} {(reset)} {(--hard)})
                (C {(git)} {(checkout)} {(-f)} {(master)})
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff -- should fail.' span_id:246))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:252) 
          (Token id:Id.Lit_Chars val:'\t test_must_fail git apply B.diff' span_id:253)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff -- should fail.' span_id:260))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:266) 
          (Token
            id: Id.Lit_Chars
            val: '\t test_must_fail git apply --index B.diff'
            span_id: 267
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff (copy) -- should fail.' span_id:274))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:280) 
          (Token id:Id.Lit_Chars val:'\t test_must_fail git apply C.diff' span_id:281)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff (copy) -- should fail.' span_id:288))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:294) 
          (Token
            id: Id.Lit_Chars
            val: '\t test_must_fail git apply --index C.diff'
            span_id: 295
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff with full-index' span_id:302))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:306) 
          (Token id:Id.Lit_Chars val:'\tdo_reset &&\n' span_id:307) (Token id:Id.Lit_Chars val:'\tgit apply B-index.diff\n' span_id:308)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff with full-index (copy)' span_id:315))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:319) 
          (Token id:Id.Lit_Chars val:'\tdo_reset &&\n' span_id:320) (Token id:Id.Lit_Chars val:'\tgit apply C-index.diff\n' span_id:321)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply full-index binary diff in new repo' span_id:328))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:332) 
          (Token id:Id.Lit_Chars val:'\t(cd other-repo &&\n' span_id:333) (Token id:Id.Lit_Chars val:'\t do_reset &&\n' span_id:334) 
          (Token
            id: Id.Lit_Chars
            val: '\t test_must_fail git apply ../B-index.diff)\n'
            span_id: 335
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff without replacement.' span_id:342))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:348) 
          (Token id:Id.Lit_Chars val:'\t git apply BF.diff' span_id:349)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff without replacement (copy).' span_id:356))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:362) 
          (Token id:Id.Lit_Chars val:'\t git apply CF.diff' span_id:363)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply binary diff.' span_id:370))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:376) 
          (Token
            id: Id.Lit_Chars
            val: '\t git apply --allow-binary-replacement --index BF.diff &&\n'
            span_id: 377
          ) (Token id:Id.Lit_Chars val:'\t test -z "$(git diff --name-status binary)"' span_id:378)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'apply binary diff (copy).' span_id:385))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'do_reset &&\n' span_id:391) 
          (Token
            id: Id.Lit_Chars
            val: '\t git apply --allow-binary-replacement --index CF.diff &&\n'
            span_id: 392
          ) (Token id:Id.Lit_Chars val:'\t test -z "$(git diff --name-status binary)"' span_id:393)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply binary -p0 diff' span_id:400))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:404) 
          (Token id:Id.Lit_Chars val:'\tdo_reset &&\n' span_id:405) (Token id:Id.Lit_Chars val:'\tgit apply -p0 --index B0.diff &&\n' span_id:406) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest -z "$(git diff --name-status binary -- file3)"\n'
            span_id: 407
          )
        )
      }
    )
    (C {(test_done)})
  ]
)