(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"git archive --format=zip test">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:SUBSTFORMAT)
          op: Equal
          rhs: {(Lit_Other "%") (H) (Lit_Other "%") (n)}
          spids: [15]
        )
      ]
      spids: [15]
    )
    (C {(test_lazy_prereq)} {(UNZIP_SYMLINKS)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tmkdir unzip-symlinks &&\n"> <"\t\tcd unzip-symlinks &&\n"> 
          <"\t\t\"$GIT_UNZIP\" \"$TEST_DIRECTORY\"/t5003/infozip-symlinks.zip &&\n"> <"\t\ttest -h symlink\n"> <"\t)\n">
        )
      }
    )
    (FuncDef
      name: check_zip
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:zipfile)
                  op: Equal
                  rhs: {($ VSub_Number "$1") (.zip)}
                  spids: [44]
                )
              ]
              spids: [44]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:listfile)
                  op: Equal
                  rhs: {($ VSub_Number "$1") (.lst)}
                  spids: [49]
                )
              ]
              spids: [49]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dir)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [54]
                )
              ]
              spids: [54]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dir_with_prefix)
                  op: Equal
                  rhs: {($ VSub_Name "$dir") (/) ($ VSub_Number "$2")}
                  spids: [58]
                )
              ]
              spids: [58]
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" extract ZIP archive"))} 
              {(SQ <"\n"> <"\t\t(mkdir $dir && cd $dir && \"$GIT_UNZIP\" ../$zipfile)\n"> <"\t">)}
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" validate filenames"))} 
              {
                (DQ ("\n") ("\t\t(cd ") (${ VSub_Name dir_with_prefix) ("a && find .) | sort >") 
                  ($ VSub_Name "$listfile") (" &&\n") ("\t\ttest_cmp a.lst ") ($ VSub_Name "$listfile") ("\n") ("\t")
                )
              }
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" validate file contents"))} 
              {(DQ ("\n") ("\t\tdiff -r a ") (${ VSub_Name dir_with_prefix) ("a\n") ("\t"))}
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dir)
                  op: Equal
                  rhs: {(eol_) ($ VSub_Number "$1")}
                  spids: [126]
                )
              ]
              spids: [126]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dir_with_prefix)
                  op: Equal
                  rhs: {($ VSub_Name "$dir") (/) ($ VSub_Number "$2")}
                  spids: [131]
                )
              ]
              spids: [131]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:extracted)
                  op: Equal
                  rhs: {(${ VSub_Name dir_with_prefix) (a)}
                  spids: [137]
                )
              ]
              spids: [137]
            )
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:original) op:Equal rhs:{(a)} spids:[144])]
              spids: [144]
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" extract ZIP archive with EOL conversion"))} 
              {(SQ <"\n"> <"\t\t(mkdir $dir && cd $dir && \"$GIT_UNZIP\" -a ../$zipfile)\n"> <"\t">)}
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" validate that text files are converted"))} 
              {
                (DQ ("\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$extracted") ("/text.cr ") 
                  ($ VSub_Name "$extracted") ("/text.crlf &&\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$extracted") ("/text.cr ") 
                  ($ VSub_Name "$extracted") ("/text.lf\n") ("\t")
                )
              }
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" validate that binary files are unchanged"))} 
              {
                (DQ ("\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$original") ("/binary.cr   ") 
                  ($ VSub_Name "$extracted") ("/binary.cr &&\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$original") ("/binary.crlf ") 
                  ($ VSub_Name "$extracted") ("/binary.crlf &&\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$original") ("/binary.lf   ") 
                  ($ VSub_Name "$extracted") ("/binary.lf\n") ("\t")
                )
              }
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" validate that diff files are converted"))} 
              {
                (DQ ("\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$extracted") ("/diff.cr ") 
                  ($ VSub_Name "$extracted") ("/diff.crlf &&\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$extracted") ("/diff.cr ") 
                  ($ VSub_Name "$extracted") ("/diff.lf\n") ("\t")
                )
              }
            )
            (C {(test_expect_success)} {(UNZIP)} {(DQ (" validate that -diff files are unchanged"))} 
              {
                (DQ ("\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$original") ("/nodiff.cr   ") 
                  ($ VSub_Name "$extracted") ("/nodiff.cr &&\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$original") ("/nodiff.crlf ") 
                  ($ VSub_Name "$extracted") ("/nodiff.crlf &&\n") ("\t\ttest_cmp_bin ") ($ VSub_Name "$original") ("/nodiff.lf   ") 
                  ($ VSub_Name "$extracted") ("/nodiff.lf\n") ("\t")
                )
              }
            )
          ]
          spids: [41]
        )
      spids: [37 40]
    )
    (C {(test_expect_success)} {(SQ <"populate workdir">)} 
      {
        (SQ <"mkdir a &&\n"> <"     echo simple textfile >a/a &&\n"> <"     mkdir a/bin &&\n"> 
          <"     cp /bin/sh a/bin &&\n"> <"     printf \"text\\r\"\t>a/text.cr &&\n"> <"     printf \"text\\r\\n\"\t>a/text.crlf &&\n"> 
          <"     printf \"text\\n\"\t>a/text.lf &&\n"> <"     printf \"text\\r\"\t>a/nodiff.cr &&\n"> <"     printf \"text\\r\\n\"\t>a/nodiff.crlf &&\n"> 
          <"     printf \"text\\n\"\t>a/nodiff.lf &&\n"> <"     printf \"\\0\\r\"\t>a/binary.cr &&\n"> <"     printf \"\\0\\r\\n\"\t>a/binary.crlf &&\n"> 
          <"     printf \"\\0\\n\"\t>a/binary.lf &&\n"> <"     printf \"\\0\\r\"\t>a/diff.cr &&\n"> <"     printf \"\\0\\r\\n\"\t>a/diff.crlf &&\n"> 
          <"     printf \"\\0\\n\"\t>a/diff.lf &&\n"> <"     printf \"A\\$Format:%s\\$O\" \"$SUBSTFORMAT\" >a/substfile1 &&\n"> 
          <"     printf \"A not substituted O\" >a/substfile2 &&\n"> <"     (p=long_path_to_a_file && cd a &&\n"> 
          <"      for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&\n"> <"      echo text >file_with_long_path)\n">
        )
      }
    )
    (C {(test_expect_success)} {(SYMLINKS) (Lit_Comma ",") (UNZIP_SYMLINKS)} {(SQ <"add symlink">)} 
      {(SQ <"\n"> <"\tln -s a a/symlink_to_a\n">)}
    )
    (C {(test_expect_success)} {(SQ <"prepare file list">)} 
      {(SQ <"\n"> <"\t(cd a && find .) | sort >a.lst\n">)}
    )
    (C {(test_expect_success)} {(SQ <"add ignored file">)} 
      {
        (SQ <"echo ignore me >a/ignored &&\n"> 
          <"     echo ignored export-ignore >.git/info/attributes">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"add files to repository">)} 
      {
        (SQ <"\n"> <"\tgit add a &&\n"> 
          <"\tGIT_COMMITTER_DATE=\"2005-05-27 22:00\" git commit -m initial\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"setup export-subst and diff attributes">)} 
      {
        (SQ <"\n"> <"\techo \"a/nodiff.* -diff\" >>.git/info/attributes &&\n"> 
          <"\techo \"a/diff.* diff\" >>.git/info/attributes &&\n"> <"\techo \"substfile?\" export-subst >>.git/info/attributes &&\n"> 
          <"\tgit log --max-count=1 \"--pretty=format:A${SUBSTFORMAT}O\" HEAD \\\n"> <"\t\t>a/substfile1\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"create bare clone">)} 
      {
        (SQ <"git clone --bare . bare.git &&\n"> 
          <"     cp .git/info/attributes bare.git/info/attributes">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"remove ignored file">)} {(SQ <"rm a/ignored">)})
    (C {(test_expect_success)} {(SQ <"git archive --format=zip">)} 
      {(SQ <"git archive --format=zip HEAD >d.zip">)}
    )
    (C {(check_zip)} {(d)})
    (C {(test_expect_success)} {(SQ <"git archive --format=zip in a bare repo">)} 
      {(SQ <"(cd bare.git && git archive --format=zip HEAD) >d1.zip">)}
    )
    (C {(test_expect_success)} {(SQ <"git archive --format=zip vs. the same in a bare repo">)} 
      {(SQ <"test_cmp_bin d.zip d1.zip">)}
    )
    (C {(test_expect_success)} {(SQ <"git archive --format=zip with --output">)} 
      {(SQ <"git archive --format=zip --output=d2.zip HEAD &&\n"> <"    test_cmp_bin d.zip d2.zip">)}
    )
    (C {(test_expect_success)} {(SQ <"git archive with --output, inferring format">)} 
      {(SQ <"\n"> <"\tgit archive --output=d3.zip HEAD &&\n"> <"\ttest_cmp_bin d.zip d3.zip\n">)}
    )
    (C {(test_expect_success)} {(SQ <"git archive --format=zip with prefix">)} 
      {(SQ <"git archive --format=zip --prefix=prefix/ HEAD >e.zip">)}
    )
    (C {(check_zip)} {(e)} {(prefix/)})
    (C {(test_expect_success)} {(SQ <"git archive -0 --format=zip on large files">)} 
      {
        (SQ <"\n"> <"\ttest_config core.bigfilethreshold 1 &&\n"> 
          <"\tgit archive -0 --format=zip HEAD >large.zip\n">
        )
      }
    )
    (C {(check_zip)} {(large)})
    (C {(test_expect_success)} {(SQ <"git archive --format=zip on large files">)} 
      {
        (SQ <"\n"> <"\ttest_config core.bigfilethreshold 1 &&\n"> 
          <"\tgit archive --format=zip HEAD >large-compressed.zip\n">
        )
      }
    )
    (C {(check_zip)} {(large-compressed)})
    (C {(test_done)})
  ]
)