(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description spids:[20])
          op: Equal
          rhs: {(SQ <'Test export of commits to CVS'>)}
          spids: [20]
        )
      ]
      spids: [20]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.Pipeline children:[(C {(test_have_prereq)} {(PERL)})] negated:T)
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:skip_all spids:[43])
                  op: Equal
                  rhs: {(SQ <'skipping git cvsexportcommit tests, perl not available'>)}
                  spids: [43]
                )
              ]
              spids: [43]
            )
            (C {(test_done)})
          ]
          spids: [16777215 40]
        )
      ]
      spids: [16777215 51]
    )
    (command.SimpleCommand
      words: [{(cvs)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})
        (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [(C {(test)} {($ VSub_QMark '$?')} {(-ne)} {(1)})]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:skip_all spids:[75])
                  op: Equal
                  rhs: {(SQ <'skipping git cvsexportcommit tests, cvs not found'>)}
                  spids: [75]
                )
              ]
              spids: [75]
            )
            (C {(test_done)})
          ]
          spids: [16777215 72]
        )
      ]
      spids: [16777215 83]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:CVSROOT spids:[86])
          op: Equal
          rhs: {($ VSub_Name '$PWD') (/tmpcvsroot)}
          spids: [86]
        )
      ]
      spids: [86]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:CVSWORK spids:[90])
          op: Equal
          rhs: {($ VSub_Name '$PWD') (/cvswork)}
          spids: [90]
        )
      ]
      spids: [90]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:GIT_DIR spids:[94])
          op: Equal
          rhs: {($ VSub_Name '$PWD') (/.git)}
          spids: [94]
        )
      ]
      spids: [94]
    )
    (C {(export)} {(CVSROOT)} {(CVSWORK)} {(GIT_DIR)})
    (C {(rm)} {(-rf)} {(DQ ($ VSub_Name '$CVSROOT'))} {(DQ ($ VSub_Name '$CVSWORK'))})
    (command.AndOr
      ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DPipe]
      children: [
        (C {(cvs)} {(init)})
        (C {(test)} {(-d)} {(DQ ($ VSub_Name '$CVSROOT'))})
        (C {(cvs)} {(-Q)} {(co)} {(-d)} {(DQ ($ VSub_Name '$CVSWORK'))} {(.)})
        (command.SimpleCommand
          words: [{(echo)}]
          redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(empty)})]
        )
        (C {(git)} {(add)} {(empty)})
        (command.SimpleCommand
          words: [{(git)} {(commit)} {(-q)} {(-a)} {(-m)} {(DQ (Initial))}]
          redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
        )
        (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
      ]
    )
    (command.FuncDef
      name: check_entries
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(sed)} {(-ne)} {(SQ <'/^\\//p'>)} {(DQ ($ VSub_Number '$1') (/CVS/Entries))})
                (C {(sort)})
                (command.SimpleCommand
                  words: [{(cut)} {(-d/)} {(-f2) (Lit_Comma ',') (3) (Lit_Comma ',') (5)}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})]
                )
              ]
              negated: F
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Number '$2'))})]
                  action: [
                    (command.SimpleCommand
                      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})]
                    )
                  ]
                  spids: [16777215 247]
                )
              ]
              else_action: [
                (command.Pipeline
                  children: [
                    (C {(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_Number '$2'))})
                    (command.SimpleCommand
                      words: [{(tr)} {(SQ <'|'>)} {(SQ <'\\012'>)}]
                      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})]
                    )
                  ]
                  negated: F
                )
              ]
              spids: [254 283]
            )
            (C {(test_cmp)} {(expected)} {(actual)})
          ]
          spids: [196]
        )
      spids: [191 195]
    )
    (C {(test_expect_success)} {(SQ <'New file'>)} 
      {
        (SQ <'mkdir A B C D E F &&\n'> <'     echo hello1 >A/newfile1.txt &&\n'> 
          <'     echo hello2 >B/newfile2.txt &&\n'> <'     cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&\n'> 
          <'     cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&\n'> <'     git add A/newfile1.txt &&\n'> <'     git add B/newfile2.txt &&\n'> 
          <'     git add C/newfile3.png &&\n'> <'     git add D/newfile4.png &&\n'> <'     git commit -a -m "Test: New file" &&\n'> 
          <'     id=$(git rev-list --max-count=1 HEAD) &&\n'> <'     (cd "$CVSWORK" &&\n'> <'     git cvsexportcommit -c $id &&\n'> 
          <'     check_entries A "newfile1.txt/1.1/" &&\n'> <'     check_entries B "newfile2.txt/1.1/" &&\n'> <'     check_entries C "newfile3.png/1.1/-kb" &&\n'> 
          <'     check_entries D "newfile4.png/1.1/-kb" &&\n'> <'     test_cmp A/newfile1.txt ../A/newfile1.txt &&\n'> 
          <'     test_cmp B/newfile2.txt ../B/newfile2.txt &&\n'> <'     test_cmp C/newfile3.png ../C/newfile3.png &&\n'> 
          <'     test_cmp D/newfile4.png ../D/newfile4.png\n'> <'     )'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Remove two files, add two and update two'>)} 
      {
        (SQ <'echo Hello1 >>A/newfile1.txt &&\n'> <'     rm -f B/newfile2.txt &&\n'> 
          <'     rm -f C/newfile3.png &&\n'> <'     echo Hello5  >E/newfile5.txt &&\n'> 
          <'     cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&\n'> <'     cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&\n'> 
          <'     git add E/newfile5.txt &&\n'> <'     git add F/newfile6.png &&\n'> <'     git commit -a -m "Test: Remove, add and update" &&\n'> 
          <'     id=$(git rev-list --max-count=1 HEAD) &&\n'> <'     (cd "$CVSWORK" &&\n'> <'     git cvsexportcommit -c $id &&\n'> 
          <'     check_entries A "newfile1.txt/1.2/" &&\n'> <'     check_entries B "" &&\n'> <'     check_entries C "" &&\n'> 
          <'     check_entries D "newfile4.png/1.2/-kb" &&\n'> <'     check_entries E "newfile5.txt/1.1/" &&\n'> <'     check_entries F "newfile6.png/1.1/-kb" &&\n'> 
          <'     test_cmp A/newfile1.txt ../A/newfile1.txt &&\n'> <'     test_cmp D/newfile4.png ../D/newfile4.png &&\n'> 
          <'     test_cmp E/newfile5.txt ../E/newfile5.txt &&\n'> <'     test_cmp F/newfile6.png ../F/newfile6.png\n'> <'     )'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Fail to change binary more than one generation old'>)} 
      {
        (SQ <'cat F/newfile6.png >>D/newfile4.png &&\n'> 
          <'     git commit -a -m "generatiion 1" &&\n'> <'     cat F/newfile6.png >>D/newfile4.png &&\n'> <'     git commit -a -m "generation 2" &&\n'> 
          <'     id=$(git rev-list --max-count=1 HEAD) &&\n'> <'     (cd "$CVSWORK" &&\n'> <'     test_must_fail git cvsexportcommit -c $id\n'> <'     )'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Remove only binary files'>)} 
      {
        (SQ <'git reset --hard HEAD^^ &&\n'> <'     rm -f D/newfile4.png &&\n'> 
          <'     git commit -a -m "test: remove only a binary file" &&\n'> <'     id=$(git rev-list --max-count=1 HEAD) &&\n'> <'     (cd "$CVSWORK" &&\n'> 
          <'     git cvsexportcommit -c $id &&\n'> <'     check_entries A "newfile1.txt/1.2/" &&\n'> <'     check_entries B "" &&\n'> 
          <'     check_entries C "" &&\n'> <'     check_entries D "" &&\n'> <'     check_entries E "newfile5.txt/1.1/" &&\n'> 
          <'     check_entries F "newfile6.png/1.1/-kb" &&\n'> <'     test_cmp A/newfile1.txt ../A/newfile1.txt &&\n'> 
          <'     test_cmp E/newfile5.txt ../E/newfile5.txt &&\n'> <'     test_cmp F/newfile6.png ../F/newfile6.png\n'> <'     )'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Remove only a text file'>)} 
      {
        (SQ <'rm -f A/newfile1.txt &&\n'> 
          <'     git commit -a -m "test: remove only a binary file" &&\n'> <'     id=$(git rev-list --max-count=1 HEAD) &&\n'> <'     (cd "$CVSWORK" &&\n'> 
          <'     git cvsexportcommit -c $id &&\n'> <'     check_entries A "" &&\n'> <'     check_entries B "" &&\n'> <'     check_entries C "" &&\n'> 
          <'     check_entries D "" &&\n'> <'     check_entries E "newfile5.txt/1.1/" &&\n'> <'     check_entries F "newfile6.png/1.1/-kb" &&\n'> 
          <'     test_cmp E/newfile5.txt ../E/newfile5.txt &&\n'> <'     test_cmp F/newfile6.png ../F/newfile6.png\n'> <'     )'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'New file with spaces in file name'>)} 
      {
        (SQ <'mkdir "G g" &&\n'> <'      echo ok then >"G g/with spaces.txt" &&\n'> 
          <'      git add "G g/with spaces.txt" && \\\n'> <'      cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \\\n'> 
          <'      git add "G g/with spaces.png" &&\n'> <'      git commit -a -m "With spaces" &&\n'> <'      id=$(git rev-list --max-count=1 HEAD) &&\n'> 
          <'      (cd "$CVSWORK" &&\n'> <'      git cvsexportcommit -c $id &&\n'> 
          <'      check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/"\n'> <'      )'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Update file with spaces in file name'>)} 
      {
        (SQ <'echo Ok then >>"G g/with spaces.txt" &&\n'> 
          <'      cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \\\n'> <'      git add "G g/with spaces.png" &&\n'> <'      git commit -a -m "Update with spaces" &&\n'> 
          <'      id=$(git rev-list --max-count=1 HEAD) &&\n'> <'      (cd "$CVSWORK" &&\n'> <'      git cvsexportcommit -c $id\n'> 
          <'      check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/"\n'> <'      )'>
        )
      }
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:p spids:[551])
                      op: Equal
                      rhs: 
                        {
                          (DQ 
                            (
'\xc3\x85/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/\xc3\xa5/\xc3\xa4/\xc3\xb6'
                            )
                          )
                        }
                      spids: [551]
                    )
                  ]
                  spids: [551]
                )
                (C {(mkdir)} {(-p)} {(DQ (tst/) ($ VSub_Name '$p'))})
                (command.SimpleCommand
                  words: [{(date)}]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(DQ (tst/) ($ VSub_Name '$p') (/day))}
                    )
                  ]
                )
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:found spids:[583])
                      op: Equal
                      rhs: 
                        {
                          (word_part.CommandSubPart
                            command_list: 
                              (command.CommandList
                                children: [(C {(find)} {(tst)} {(-type)} {(f)} {(-print)})]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [584 594]
                          )
                        }
                      spids: [583]
                    )
                  ]
                  spids: [583]
                )
                (C {(test)} {(DQ (z) ($ VSub_Name '$found'))} {(Lit_Other '=')} 
                  {(DQ (ztst/) ($ VSub_Name '$p') (/day))}
                )
                (C {(rm)} {(-fr)} {(tst)})
              ]
            )
          ]
          action: [
            (C {(test_expect_success)} {(KW_Bang '!') (MINGW)} {(SQ <'File with non-ascii file name'>)} 
              {
                (SQ 
                  <
'mkdir -p \xc3\x85/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/\xc3\xa5/\xc3\xa4/\xc3\xb6 &&\n'
                  > 
                  <
'      echo Foo >\xc3\x85/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/\xc3\xa5/\xc3\xa4/\xc3\xb6/g\xc3\xa5rdets\xc3\xa5g\xc3\xa5rdet.txt &&\n'
                  > 
                  <
'      git add \xc3\x85/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/\xc3\xa5/\xc3\xa4/\xc3\xb6/g\xc3\xa5rdets\xc3\xa5g\xc3\xa5rdet.txt &&\n'
                  > 
                  <
'      cp "$TEST_DIRECTORY"/test-binary-1.png \xc3\x85/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/\xc3\xa5/\xc3\xa4/\xc3\xb6/g\xc3\xa5rdets\xc3\xa5g\xc3\xa5rdet.png &&\n'
                  > 
                  <
'      git add \xc3\x85/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/\xc3\xa5/\xc3\xa4/\xc3\xb6/g\xc3\xa5rdets\xc3\xa5g\xc3\xa5rdet.png &&\n'
                  > <'      git commit -a -m "G\xc3\xa5r det s\xc3\xa5 g\xc3\xa5r det" && \\\n'> 
                  <'      id=$(git rev-list --max-count=1 HEAD) &&\n'> <'      (cd "$CVSWORK" &&\n'> <'      git cvsexportcommit -v -c $id &&\n'> <'      check_entries \\\n'> 
                  <
'      "\xc3\x85/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/\xc3\xa5/\xc3\xa4/\xc3\xb6" \\\n'
                  > 
                  <
'      "g\xc3\xa5rdets\xc3\xa5g\xc3\xa5rdet.png/1.1/-kb|g\xc3\xa5rdets\xc3\xa5g\xc3\xa5rdet.txt/1.1/"\n'
                  > <'      )'>
                )
              }
            )
          ]
          spids: [16777215 623]
        )
      ]
      spids: [16777215 659]
    )
    (C {(rm)} {(-fr)} {(tst)})
    (C {(test_expect_success)} {(SQ <'Mismatching patch should fail'>)} 
      {
        (SQ <'date >>"E/newfile5.txt" &&\n'> <'      git add "E/newfile5.txt" &&\n'> 
          <'      git commit -a -m "Update one" &&\n'> <'      date >>"E/newfile5.txt" &&\n'> <'      git add "E/newfile5.txt" &&\n'> 
          <'      git commit -a -m "Update two" &&\n'> <'      id=$(git rev-list --max-count=1 HEAD) &&\n'> <'      (cd "$CVSWORK" &&\n'> 
          <'      test_must_fail git cvsexportcommit -c $id\n'> <'      )'>
        )
      }
    )
    (C {(test_expect_success)} {(FILEMODE)} {(SQ <'Retain execute bit'>)} 
      {
        (SQ <'mkdir G &&\n'> <'      echo executeon >G/on &&\n'> <'      chmod +x G/on &&\n'> 
          <'      echo executeoff >G/off &&\n'> <'      git add G/on &&\n'> <'      git add G/off &&\n'> <'      git commit -a -m "Execute test" &&\n'> 
          <'      (cd "$CVSWORK" &&\n'> <'      git cvsexportcommit -c HEAD\n'> <'      test -x G/on &&\n'> <'      ! test -x G/off\n'> 
          <'      )'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'-w option should work with relative GIT_DIR'>)} 
      {
        (SQ <'\n'> <'      mkdir W &&\n'> <'      echo foobar >W/file1.txt &&\n'> 
          <'      echo bazzle >W/file2.txt &&\n'> <'      git add W/file1.txt &&\n'> <'      git add W/file2.txt &&\n'> 
          <'      git commit -m "More updates" &&\n'> <'      id=$(git rev-list --max-count=1 HEAD) &&\n'> <'      (cd "$GIT_DIR" &&\n'> 
          <'      GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id &&\n'> <'      check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" &&\n'> 
          <'      test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt &&\n'> <'      test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt\n'> <'      )\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'check files before directories'>)} 
      {
        (SQ <'\n'> <'\n'> <'\techo Notes > release-notes &&\n'> <'\tgit add release-notes &&\n'> 
          <'\tgit commit -m "Add release notes" release-notes &&\n'> <'\tid=$(git rev-parse HEAD) &&\n'> <'\tgit cvsexportcommit -w "$CVSWORK" -c $id &&\n'> <'\n'> 
          <'\techo new > DS &&\n'> <'\techo new > E/DS &&\n'> <'\techo modified > release-notes &&\n'> 
          <'\tgit add DS E/DS release-notes &&\n'> <'\tgit commit -m "Add two files with the same basename" &&\n'> <'\tid=$(git rev-parse HEAD) &&\n'> 
          <'\tgit cvsexportcommit -w "$CVSWORK" -c $id &&\n'> <'\tcheck_entries "$CVSWORK/E" "DS/1.1/|newfile5.txt/1.1/" &&\n'> 
          <'\tcheck_entries "$CVSWORK" "DS/1.1/|release-notes/1.2/" &&\n'> <'\ttest_cmp "$CVSWORK/DS" DS &&\n'> <'\ttest_cmp "$CVSWORK/E/DS" E/DS &&\n'> 
          <'\ttest_cmp "$CVSWORK/release-notes" release-notes\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'re-commit a removed filename which remains in CVS attic'>)} 
      {
        (SQ <'\n'> <'\n'> <'    (cd "$CVSWORK" &&\n'> <'     echo >attic_gremlin &&\n'> 
          <'     cvs -Q add attic_gremlin &&\n'> <'     cvs -Q ci -m "added attic_gremlin" &&\n'> <'     rm attic_gremlin &&\n'> 
          <'     cvs -Q rm attic_gremlin &&\n'> <'     cvs -Q ci -m "removed attic_gremlin") &&\n'> <'\n'> <'    echo > attic_gremlin &&\n'> 
          <'    git add attic_gremlin &&\n'> <'    git commit -m "Added attic_gremlin" &&\n'> <'\tgit cvsexportcommit -w "$CVSWORK" -c HEAD &&\n'> 
          <'    (cd "$CVSWORK"; cvs -Q update -d) &&\n'> <'    test -f "$CVSWORK/attic_gremlin"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'commit a file with leading spaces in the name'>)} 
      {
        (SQ <'\n'> <'\n'> <'\techo space > " space" &&\n'> <'\tgit add " space" &&\n'> 
          <'\tgit commit -m "Add a file with a leading space" &&\n'> <'\tid=$(git rev-parse HEAD) &&\n'> <'\tgit cvsexportcommit -w "$CVSWORK" -c $id &&\n'> 
          <
'\tcheck_entries "$CVSWORK" " space/1.1/|DS/1.1/|attic_gremlin/1.3/|release-notes/1.2/" &&\n'
          > <'\ttest_cmp "$CVSWORK/ space" " space"\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'use the same checkout for Git and CVS'>)} 
      {
        (SQ <'\n'> <'\n'> <'\t(mkdir shared &&\n'> <'\t cd shared &&\n'> <'\t sane_unset GIT_DIR &&\n'> 
          <'\t cvs co . &&\n'> <'\t git init &&\n'> <'\t git add " space" &&\n'> <'\t git commit -m "fake initial commit" &&\n'> 
          <'\t echo Hello >> " space" &&\n'> <'\t git commit -m "Another change" " space" &&\n'> <'\t git cvsexportcommit -W -p -u -c HEAD &&\n'> 
          <'\t grep Hello " space" &&\n'> <'\t git diff-files)\n'> <'\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)