(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ <'git-cvsserver -kb modes\n'> <'\n'> 
                <'tests -kb mode for binary files when accessing a git\n'> <'repository using cvs CLI client via git-cvsserver server'>
              )
            }
          spids: [16]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: marked_as
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:foundEntry)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (C {<grep>} {(DQ <'^/'> ($ Id.VSub_Number '$2') <'/'>)} 
                              {(DQ ($ Id.VSub_Number '$1') <'/CVS/Entries'>)}
                            )
                        )
                      )
                    }
                  spids: [38]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<x> (DQ ($ Id.VSub_DollarName '$foundEntry'))} 
                              {<Id.Lit_Equals '='>} {<x> (DQ )} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'NOT FOUND: '> ($ Id.VSub_Number '$1') <' '> ($ Id.VSub_Number '$2') 
                            <' 1 '> ($ Id.VSub_Number '$3')
                          )
                        }
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_DGreat '>>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
                        )
                      ]
                      do_fork: T
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Return return>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [57 76]
                )
              ]
            )
            (C {<test>} 
              {<x> 
                (DQ 
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: 
                      (command.Pipeline
                        children: [
                          (C {<grep>} {(DQ <'^/'> ($ Id.VSub_Number '$2') <'/'>)} 
                            {(DQ ($ Id.VSub_Number '$1') <'/CVS/Entries'>)}
                          )
                          (C {<cut>} {<'-d/'>} {<-f5>})
                        ]
                        negated: F
                      )
                  )
                )
              } {<Id.Lit_Equals '='>} {<x> (DQ ($ Id.VSub_Number '$3'))}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:stat)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [144]
                )
              ]
            )
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ ($ Id.VSub_Number '$1') <' '> ($ Id.VSub_Number '$2') <' '> 
                    ($ Id.VSub_DollarName '$stat') <' \''> ($ Id.VSub_Number '$3') <'\''>
                  )
                }
              ]
              redirects: [
                (redir
                  op: <Id.Redir_DGreat '>>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
                )
              ]
              do_fork: T
            )
            (command.ControlFlow
              token: <Id.ControlFlow_Return return>
              arg_word: {($ Id.VSub_DollarName '$stat')}
            )
          ]
        )
    )
    (command.ShFunction
      name: not_present
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:foundEntry)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (C {<grep>} {(DQ <'^/'> ($ Id.VSub_Number '$2') <'/'>)} 
                              {(DQ ($ Id.VSub_Number '$1') <'/CVS/Entries'>)}
                            )
                        )
                      )
                    }
                  spids: [185]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-r>} 
                              {(DQ ($ Id.VSub_Number '$1') <'/'> ($ Id.VSub_Number '$2'))} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'Error: File still exists: '> ($ Id.VSub_Number '$1') <' '> 
                            ($ Id.VSub_Number '$2')
                          )
                        }
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_DGreat '>>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
                        )
                      ]
                      do_fork: T
                    )
                    (command.Sentence
                      child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  spids: [204 220]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<x> (DQ ($ Id.VSub_DollarName '$foundEntry'))} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<x> (DQ )} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'Error: should not have found: '> ($ Id.VSub_Number '$1') <' '> 
                            ($ Id.VSub_Number '$2')
                          )
                        }
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_DGreat '>>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
                        )
                      ]
                      do_fork: T
                    )
                    (command.Sentence
                      child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  spids: [251 271]
                )
              ]
              else_action: [
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ <'Correctly not found: '> ($ Id.VSub_Number '$1') <' '> 
                        ($ Id.VSub_Number '$2')
                      )
                    }
                  ]
                  redirects: [
                    (redir
                      op: <Id.Redir_DGreat '>>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
                    )
                  ]
                  do_fork: T
                )
                (command.Sentence
                  child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: check_status_options
      body: 
        (BraceGroup
          children: [
            (command.Subshell
              child: 
                (command.AndOr
                  ops: [Id.Op_DAmp]
                  children: [
                    (C {<cd>} {(DQ ($ Id.VSub_Number '$1'))})
                    (command.Simple
                      words: [{<cvs>} {<-Q>} {<status>} {(DQ ($ Id.VSub_Number '$2'))}]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/status.out'>)}
                        )
                        (redir
                          op: <Id.Redir_GreatAnd '2>&'>
                          loc: (redir_loc.Fd fd:2)
                          arg: {<1>}
                        )
                      ]
                      more_env: [
                        (env_pair
                          name: GIT_CONFIG
                          val: {(DQ ($ Id.VSub_DollarName '$git_config'))}
                          spids: [349]
                        )
                      ]
                      do_fork: T
                    )
                  ]
                )
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<x> (DQ ($ Id.VSub_QMark '$?'))} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<x> (DQ <0>)} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'Error from cvs status: '> ($ Id.VSub_Number '$1') <' '> 
                            ($ Id.VSub_Number '$2')
                          )
                        }
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_DGreat '>>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
                        )
                      ]
                      do_fork: T
                    )
                    (command.Sentence
                      child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  spids: [380 401]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:got)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (C {<sed>} {<-n>} {<-e>} {(SQ <'s/^[ \t]*Sticky Options:[ \t]*//p'>)} 
                              {(DQ (${ Id.VSub_Name WORKDIR) <'/status.out'>)}
                            )
                        )
                      )
                    }
                  spids: [432]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:expect)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$3'))}
                  spids: [455]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<x> (DQ ($ Id.VSub_DollarName '$expect'))} 
                              {<Id.Lit_Equals '='>} {<x> (DQ )} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:expect)
                          op: assign_op.Equal
                          rhs: {(DQ <'(none)'>)}
                          spids: [483]
                        )
                      ]
                    )
                  ]
                  spids: [461 480]
                )
              ]
            )
            (C {<test>} {<x> (DQ ($ Id.VSub_DollarName '$got'))} {<Id.Lit_Equals '='>} 
              {<x> (DQ ($ Id.VSub_DollarName '$expect'))}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:stat)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [507]
                )
              ]
            )
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ <'cvs status: '> ($ Id.VSub_Number '$1') <' '> ($ Id.VSub_Number '$2') <' '> 
                    ($ Id.VSub_DollarName '$stat') <' \''> ($ Id.VSub_Number '$3') <'\' \''> ($ Id.VSub_DollarName '$got') <'\''>
                  )
                }
              ]
              redirects: [
                (redir
                  op: <Id.Redir_DGreat '>>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
                )
              ]
              do_fork: T
            )
            (command.ControlFlow
              token: <Id.ControlFlow_Return return>
              arg_word: {($ Id.VSub_DollarName '$stat')}
            )
          ]
        )
    )
    (command.Simple
      words: [{<cvs>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
        (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
      ]
      do_fork: T
    )
    (command.If
      arms: [
        (if_arm
          cond: (condition.Shell commands:[(C {<test>} {($ Id.VSub_QMark '$?')} {<-ne>} {<1>})])
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: {(SQ <'skipping git-cvsserver tests, cvs not found'>)}
                  spids: [565]
                )
              ]
            )
            (C {<test_done>})
          ]
          spids: [552 562]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [(command.Pipeline children:[(C {<test_have_prereq>} {<PERL>})] negated:T)]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: {(SQ <'skipping git-cvsserver tests, perl not available'>)}
                  spids: [586]
                )
              ]
            )
            (C {<test_done>})
          ]
          spids: [575 583]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [{<perl>} {<-e>} {(SQ <'use DBI; use DBD::SQLite'>)}]
          redirects: [
            (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
            (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
          ]
          do_fork: T
        )
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: {(SQ <'skipping git-cvsserver tests, Perl SQLite interface unavailable'>)}
                  spids: [615]
                )
              ]
            )
            (C {<test_done>})
          ]
        )
      ]
    )
    (C {<unset>} {<GIT_DIR>} {<GIT_CONFIG>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:WORKDIR)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$PWD')}
          spids: [632]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SERVERDIR)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$PWD') <'/gitcvs.git'>}
          spids: [635]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:git_config)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$SERVERDIR') <'/config'>)}
          spids: [639]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CVSROOT)
          op: assign_op.Equal
          rhs: {(DQ <':fork:'> ($ Id.VSub_DollarName '$SERVERDIR'))}
          spids: [645]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CVSWORK)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$PWD') <'/cvswork'>)}
          spids: [651]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CVS_SERVER)
          op: assign_op.Equal
          rhs: {<git-cvsserver>}
          spids: [657]
        )
      ]
    )
    (C {<export>} {<CVSROOT>} {<CVS_SERVER>})
    (C {<rm>} {<-rf>} {(DQ ($ Id.VSub_DollarName '$CVSWORK'))} {(DQ ($ Id.VSub_DollarName '$SERVERDIR'))})
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'    git config push.default matching &&\n'> 
          <'    echo "Simple text file" >textfile.c &&\n'> <'    echo "File with embedded NUL: Q <- there" | q_to_nul > binfile.bin &&\n'> 
          <'    mkdir subdir &&\n'> <'    echo "Another text file" > subdir/file.h &&\n'> 
          <'    echo "Another binary: Q (this time CR)" | q_to_cr > subdir/withCr.bin &&\n'> <'    echo "Mixed up NUL, but marked text: Q <- there" | q_to_nul > mixedUp.c &&\n'> 
          <'    echo "Unspecified" > subdir/unspecified.other &&\n'> <'    echo "/*.bin -crlf" > .gitattributes &&\n'> <'    echo "/*.c crlf" >> .gitattributes &&\n'> 
          <'    echo "subdir/*.bin -crlf" >> .gitattributes &&\n'> <'    echo "subdir/*.c crlf" >> .gitattributes &&\n'> 
          <'    echo "subdir/file.h crlf" >> .gitattributes &&\n'> <'    git add .gitattributes textfile.c binfile.bin mixedUp.c subdir/* &&\n'> 
          <'    git commit -q -m "First Commit" &&\n'> <'    git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&\n'> 
          <'    GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&\n'> <'    GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'cvs co (default crlf)'>)} 
      {
        (SQ <'\n'> <'    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n'> 
          <'    test x"$(grep '>
        ) <'/-k'> (SQ <' cvswork/CVS/Entries cvswork/subdir/CVS/Entries)" = x""\n'>)
      }
    )
    (C {<rm>} {<-rf>} {<cvswork>})
    (C {<test_expect_success>} {(SQ <'cvs co (allbinary)'>)} 
      {
        (SQ <'\n'> <'    GIT_DIR="$SERVERDIR" git config --bool gitcvs.allbinary true &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n'> <'    marked_as cvswork textfile.c -kb &&\n'> <'    marked_as cvswork binfile.bin -kb &&\n'> 
          <'    marked_as cvswork .gitattributes -kb &&\n'> <'    marked_as cvswork mixedUp.c -kb &&\n'> <'    marked_as cvswork/subdir withCr.bin -kb &&\n'> 
          <'    marked_as cvswork/subdir file.h -kb &&\n'> <'    marked_as cvswork/subdir unspecified.other -kb\n'>
        )
      }
    )
    (C {<rm>} {<-rf>} {<cvswork>} {<cvs.log>})
    (C {<test_expect_success>} {(SQ <'cvs co (use attributes/allbinary)'>)} 
      {
        (SQ <'\n'> <'    GIT_DIR="$SERVERDIR" git config --bool gitcvs.usecrlfattr true &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n'> <'    marked_as cvswork textfile.c "" &&\n'> <'    marked_as cvswork binfile.bin -kb &&\n'> 
          <'    marked_as cvswork .gitattributes -kb &&\n'> <'    marked_as cvswork mixedUp.c "" &&\n'> <'    marked_as cvswork/subdir withCr.bin -kb &&\n'> 
          <'    marked_as cvswork/subdir file.h "" &&\n'> <'    marked_as cvswork/subdir unspecified.other -kb\n'>
        )
      }
    )
    (C {<rm>} {<-rf>} {<cvswork>})
    (C {<test_expect_success>} {(SQ <'cvs co (use attributes)'>)} 
      {
        (SQ <'\n'> <'    GIT_DIR="$SERVERDIR" git config --bool gitcvs.allbinary false &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n'> <'    marked_as cvswork textfile.c "" &&\n'> <'    marked_as cvswork binfile.bin -kb &&\n'> 
          <'    marked_as cvswork .gitattributes "" &&\n'> <'    marked_as cvswork mixedUp.c "" &&\n'> <'    marked_as cvswork/subdir withCr.bin -kb &&\n'> 
          <'    marked_as cvswork/subdir file.h "" &&\n'> <'    marked_as cvswork/subdir unspecified.other ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'adding files'>)} 
      {
        (SQ <'\n'> <'    (cd cvswork &&\n'> <'    (cd subdir &&\n'> 
          <'    echo "more text" > src.c &&\n'> <'    GIT_CONFIG="$git_config" cvs -Q add src.c >cvs.log 2>&1 &&\n'> <'    marked_as . src.c "" &&\n'> 
          <'    echo "pseudo-binary" > temp.bin\n'> <'    ) &&\n'> <'    GIT_CONFIG="$git_config" cvs -Q add subdir/temp.bin >cvs.log 2>&1 &&\n'> 
          <'    marked_as subdir temp.bin "-kb" &&\n'> <'    cd subdir &&\n'> <'    GIT_CONFIG="$git_config" cvs -Q ci -m "adding files" >cvs.log 2>&1 &&\n'> 
          <'    marked_as . temp.bin "-kb" &&\n'> <'    marked_as . src.c ""\n'> <'    )\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <updating>)} 
      {(SQ <'\n'> <'    git pull gitcvs.git &&\n'> <'    echo '>) <hi> 
        (SQ <' > subdir/newfile.bin &&\n'> <'    echo '>) <junk> (SQ <' > subdir/file.h &&\n'> <'    echo '>) <hi> (SQ <' > subdir/newfile.c &&\n'> <'    echo '>) 
        <hello> 
        (SQ <' >> binfile.bin &&\n'> 
          <'    git add subdir/newfile.bin subdir/file.h subdir/newfile.c binfile.bin &&\n'> <'    git commit -q -m "Add and change some files" &&\n'> <'    git push gitcvs.git >/dev/null &&\n'> 
          <'    (cd cvswork &&\n'> <'    GIT_CONFIG="$git_config" cvs -Q update\n'> <'    ) &&\n'> 
          <'    marked_as cvswork textfile.c "" &&\n'> <'    marked_as cvswork binfile.bin -kb &&\n'> <'    marked_as cvswork .gitattributes "" &&\n'> 
          <'    marked_as cvswork mixedUp.c "" &&\n'> <'    marked_as cvswork/subdir withCr.bin -kb &&\n'> <'    marked_as cvswork/subdir file.h "" &&\n'> 
          <'    marked_as cvswork/subdir unspecified.other "" &&\n'> <'    marked_as cvswork/subdir newfile.bin -kb &&\n'> 
          <'    marked_as cvswork/subdir newfile.c "" &&\n'> <'    echo "File with embedded NUL: Q <- there" | q_to_nul > tmpExpect1 &&\n'> 
          <'    echo "hello" >> tmpExpect1 &&\n'> <'    cmp cvswork/binfile.bin tmpExpect1\n'>
        )
      }
    )
    (C {<rm>} {<-rf>} {<cvswork>})
    (C {<test_expect_success>} {(SQ <'cvs co (use attributes/guess)'>)} 
      {
        (SQ <'\n'> <'    GIT_DIR="$SERVERDIR" git config gitcvs.allbinary guess &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n'> <'    marked_as cvswork textfile.c "" &&\n'> <'    marked_as cvswork binfile.bin -kb &&\n'> 
          <'    marked_as cvswork .gitattributes "" &&\n'> <'    marked_as cvswork mixedUp.c "" &&\n'> <'    marked_as cvswork/subdir withCr.bin -kb &&\n'> 
          <'    marked_as cvswork/subdir file.h "" &&\n'> <'    marked_as cvswork/subdir unspecified.other "" &&\n'> 
          <'    marked_as cvswork/subdir newfile.bin -kb &&\n'> <'    marked_as cvswork/subdir newfile.c ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'setup multi-line files'>)} 
      {
        (SQ <'\n'> <'    ( echo "line 1" &&\n'> <'      echo "line 2" &&\n'> 
          <'      echo "line 3" &&\n'> <'      echo "line 4 with NUL: Q <-" ) | q_to_nul > multiline.c &&\n'> 
          <'    git add multiline.c &&\n'> <'    ( echo "line 1" &&\n'> <'      echo "line 2" &&\n'> <'      echo "line 3" &&\n'> 
          <'      echo "line 4" ) | q_to_nul > multilineTxt.c &&\n'> <'    git add multilineTxt.c &&\n'> <'    git commit -q -m "multiline files" &&\n'> 
          <'    git push gitcvs.git >/dev/null\n'>
        )
      }
    )
    (C {<rm>} {<-rf>} {<cvswork>})
    (C {<test_expect_success>} {(SQ <'cvs co (guess)'>)} 
      {
        (SQ <'\n'> <'    GIT_DIR="$SERVERDIR" git config --bool gitcvs.usecrlfattr false &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n'> <'    marked_as cvswork textfile.c "" &&\n'> <'    marked_as cvswork binfile.bin -kb &&\n'> 
          <'    marked_as cvswork .gitattributes "" &&\n'> <'    marked_as cvswork mixedUp.c -kb &&\n'> <'    marked_as cvswork multiline.c -kb &&\n'> 
          <'    marked_as cvswork multilineTxt.c "" &&\n'> <'    marked_as cvswork/subdir withCr.bin -kb &&\n'> <'    marked_as cvswork/subdir file.h "" &&\n'> 
          <'    marked_as cvswork/subdir unspecified.other "" &&\n'> <'    marked_as cvswork/subdir newfile.bin "" &&\n'> <'    marked_as cvswork/subdir newfile.c ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'cvs co another copy (guess)'>)} 
      {
        (SQ <'\n'> <'    GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n'> 
          <'    marked_as cvswork2 textfile.c "" &&\n'> <'    marked_as cvswork2 binfile.bin -kb &&\n'> <'    marked_as cvswork2 .gitattributes "" &&\n'> 
          <'    marked_as cvswork2 mixedUp.c -kb &&\n'> <'    marked_as cvswork2 multiline.c -kb &&\n'> <'    marked_as cvswork2 multilineTxt.c "" &&\n'> 
          <'    marked_as cvswork2/subdir withCr.bin -kb &&\n'> <'    marked_as cvswork2/subdir file.h "" &&\n'> 
          <'    marked_as cvswork2/subdir unspecified.other "" &&\n'> <'    marked_as cvswork2/subdir newfile.bin "" &&\n'> <'    marked_as cvswork2/subdir newfile.c ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'cvs status - sticky options'>)} 
      {
        (SQ <'\n'> <'    check_status_options cvswork2 textfile.c "" &&\n'> 
          <'    check_status_options cvswork2 binfile.bin -kb &&\n'> <'    check_status_options cvswork2 .gitattributes "" &&\n'> 
          <'    check_status_options cvswork2 mixedUp.c -kb &&\n'> <'    check_status_options cvswork2 multiline.c -kb &&\n'> 
          <'    check_status_options cvswork2 multilineTxt.c "" &&\n'> <'    check_status_options cvswork2/subdir withCr.bin -kb &&\n'> 
          <'    check_status_options cvswork2 subdir/withCr.bin -kb &&\n'> <'    check_status_options cvswork2/subdir file.h "" &&\n'> 
          <'    check_status_options cvswork2 subdir/file.h "" &&\n'> <'    check_status_options cvswork2/subdir unspecified.other "" &&\n'> 
          <'    check_status_options cvswork2/subdir newfile.bin "" &&\n'> <'    check_status_options cvswork2/subdir newfile.c ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'add text (guess)'>)} 
      {
        (SQ <'\n'> <'    (cd cvswork &&\n'> <'    echo "simpleText" > simpleText.c &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q add simpleText.c\n'> <'    ) &&\n'> <'    marked_as cvswork simpleText.c ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'add bin (guess)'>)} 
      {
        (SQ <'\n'> <'    (cd cvswork &&\n'> 
          <'    echo "simpleBin: NUL: Q <- there" | q_to_nul > simpleBin.bin &&\n'> <'    GIT_CONFIG="$git_config" cvs -Q add simpleBin.bin\n'> <'    ) &&\n'> 
          <'    marked_as cvswork simpleBin.bin -kb\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'remove files (guess)'>)} 
      {
        (SQ <'\n'> <'    (cd cvswork &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q rm -f subdir/file.h &&\n'> <'    (cd subdir &&\n'> <'    GIT_CONFIG="$git_config" cvs -Q rm -f withCr.bin\n'> <'    )) &&\n'> 
          <'    marked_as cvswork/subdir withCr.bin -kb &&\n'> <'    marked_as cvswork/subdir file.h ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'cvs ci (guess)'>)} 
      {
        (SQ <'\n'> <'    (cd cvswork &&\n'> 
          <'    GIT_CONFIG="$git_config" cvs -Q ci -m "add/rm files" >cvs.log 2>&1\n'> <'    ) &&\n'> <'    marked_as cvswork textfile.c "" &&\n'> 
          <'    marked_as cvswork binfile.bin -kb &&\n'> <'    marked_as cvswork .gitattributes "" &&\n'> <'    marked_as cvswork mixedUp.c -kb &&\n'> 
          <'    marked_as cvswork multiline.c -kb &&\n'> <'    marked_as cvswork multilineTxt.c "" &&\n'> <'    not_present cvswork/subdir withCr.bin &&\n'> 
          <'    not_present cvswork/subdir file.h &&\n'> <'    marked_as cvswork/subdir unspecified.other "" &&\n'> 
          <'    marked_as cvswork/subdir newfile.bin "" &&\n'> <'    marked_as cvswork/subdir newfile.c "" &&\n'> <'    marked_as cvswork simpleBin.bin -kb &&\n'> 
          <'    marked_as cvswork simpleText.c ""\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'update subdir of other copy (guess)'>)} 
      {
        (SQ <'\n'> <'    (cd cvswork2/subdir &&\n'> <'    GIT_CONFIG="$git_config" cvs -Q update\n'> 
          <'    ) &&\n'> <'    marked_as cvswork2 textfile.c "" &&\n'> <'    marked_as cvswork2 binfile.bin -kb &&\n'> 
          <'    marked_as cvswork2 .gitattributes "" &&\n'> <'    marked_as cvswork2 mixedUp.c -kb &&\n'> <'    marked_as cvswork2 multiline.c -kb &&\n'> 
          <'    marked_as cvswork2 multilineTxt.c "" &&\n'> <'    not_present cvswork2/subdir withCr.bin &&\n'> <'    not_present cvswork2/subdir file.h &&\n'> 
          <'    marked_as cvswork2/subdir unspecified.other "" &&\n'> <'    marked_as cvswork2/subdir newfile.bin "" &&\n'> 
          <'    marked_as cvswork2/subdir newfile.c "" &&\n'> <'    not_present cvswork2 simpleBin.bin &&\n'> <'    not_present cvswork2 simpleText.c\n'>
        )
      }
    )
    (command.Simple
      words: [{<echo>} {(DQ <'starting update/merge'>)}]
      redirects: [
        (redir
          op: <Id.Redir_DGreat '>>'>
          loc: (redir_loc.Fd fd:1)
          arg: {(DQ (${ Id.VSub_Name WORKDIR) <'/marked.log'>)}
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'update/merge full other copy (guess)'>)} 
      {
        (SQ <'\n'> <'    git pull gitcvs.git master &&\n'> 
          <'    sed "s/3/replaced_3/" < multilineTxt.c > ml.temp &&\n'> <'    mv ml.temp multilineTxt.c &&\n'> <'    git add multilineTxt.c &&\n'> 
          <'    git commit -q -m "modify multiline file" >> "${WORKDIR}/marked.log" &&\n'> <'    git push gitcvs.git >/dev/null &&\n'> <'    (cd cvswork2 &&\n'> 
          <'    sed "s/1/replaced_1/" < multilineTxt.c > ml.temp &&\n'> <'    mv ml.temp multilineTxt.c &&\n'> <'    GIT_CONFIG="$git_config" cvs update > cvs.log 2>&1\n'> 
          <'    ) &&\n'> <'    marked_as cvswork2 textfile.c "" &&\n'> <'    marked_as cvswork2 binfile.bin -kb &&\n'> 
          <'    marked_as cvswork2 .gitattributes "" &&\n'> <'    marked_as cvswork2 mixedUp.c -kb &&\n'> <'    marked_as cvswork2 multiline.c -kb &&\n'> 
          <'    marked_as cvswork2 multilineTxt.c "" &&\n'> <'    not_present cvswork2/subdir withCr.bin &&\n'> <'    not_present cvswork2/subdir file.h &&\n'> 
          <'    marked_as cvswork2/subdir unspecified.other "" &&\n'> <'    marked_as cvswork2/subdir newfile.bin "" &&\n'> 
          <'    marked_as cvswork2/subdir newfile.c "" &&\n'> <'    marked_as cvswork2 simpleBin.bin -kb &&\n'> <'    marked_as cvswork2 simpleText.c "" &&\n'> 
          <'    echo "line replaced_1" > tmpExpect2 &&\n'> <'    echo "line 2" >> tmpExpect2 &&\n'> <'    echo "line replaced_3" >> tmpExpect2 &&\n'> 
          <'    echo "line 4" | q_to_nul >> tmpExpect2 &&\n'> <'    cmp cvswork2/multilineTxt.c tmpExpect2\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)