(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git p4 fetching changes in multiple blocks'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./lib-git-p4.sh'>})
    (C {<test_expect_success>} {(SQ <'start p4d'>)} {(SQ <'\n'> <'\tstart_p4d\n'>)})
    (command.ShFunction
      name: create_restricted_group
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<p4>} {<group>} {<-i>}]
              redirects: [
                (redir
                  op: <Id.Redir_DLessDash '<<-'>
                  loc: (redir_loc.Fd fd:0)
                  arg: 
                    (redir_param.MultiLine
                      here_begin: {<EOF>}
                      here_end_span_id: 48
                      stdin_parts: [
                        <'Group: restricted\n'>
                        <'MaxResults: 7\n'>
                        <'MaxScanRows: 40\n'>
                        <'Users: author\n'>
                      ]
                    )
                )
              ]
              do_fork: T
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'Create group with limited maxrows'>)} 
      {(SQ <'\n'> <'\tcreate_restricted_group\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'Create a repo with many changes'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tclient_view "//depot/included/... //client/included/..." \\\n'> 
          <'\t\t\t    "//depot/excluded/... //client/excluded/..." &&\n'> <'\t\tmkdir -p "$cli/included" "$cli/excluded" &&\n'> <'\t\tcd "$cli/included" &&\n'> 
          <'\t\t>file.txt &&\n'> <'\t\tp4 add file.txt &&\n'> <'\t\tp4 submit -d "Add file.txt" &&\n'> 
          <'\t\tfor i in $(test_seq 0 5)\n'> <'\t\tdo\n'> <'\t\t\t>outer$i.txt &&\n'> <'\t\t\tp4 add outer$i.txt &&\n'> 
          <'\t\t\tp4 submit -d "Adding outer$i.txt" &&\n'> <'\t\t\tfor j in $(test_seq 0 5)\n'> <'\t\t\tdo\n'> <'\t\t\t\tp4 edit file.txt &&\n'> 
          <'\t\t\t\techo $i$j >file.txt &&\n'> <'\t\t\t\tp4 submit -d "Commit $i$j" || exit\n'> <'\t\t\tdone || exit\n'> <'\t\tdone\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Default user cannot fetch changes'>)} 
      {(SQ <'\n'> <'\t! p4 changes -m 1 //depot/...\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'Clone the repo'>)} 
      {
        (SQ <'\n'> 
          <'\tgit p4 clone --dest="$git" --changes-block-size=7 --verbose //depot/included@all\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'All files are present'>)} 
      {
        (SQ <'\n'> <'\techo file.txt >expected &&\n'> 
          <
'\ttest_write_lines outer0.txt outer1.txt outer2.txt outer3.txt outer4.txt >>expected &&\n'
          > <'\ttest_write_lines outer5.txt >>expected &&\n'> <'\tls "$git" >current &&\n'> 
          <'\ttest_cmp expected current\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'file.txt is correct'>)} 
      {(SQ <'\n'> <'\techo 55 >expected &&\n'> <'\ttest_cmp expected "$git/file.txt"\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'Correct number of commits'>)} 
      {
        (SQ <'\n'> <'\t(cd "$git" && git log --oneline) >log &&\n'> <'\twc -l log &&\n'> 
          <'\ttest_line_count = 43 log\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Previous version of file.txt is correct'>)} 
      {
        (SQ <'\n'> <'\t(cd "$git" && git checkout HEAD^^) &&\n'> <'\techo 53 >expected &&\n'> 
          <'\ttest_cmp expected "$git/file.txt"\n'>
        )
      }
    )
    (command.ShFunction
      name: p4_add_file
      body: 
        (BraceGroup
          children: [
            (command.Subshell
              child: 
                (command.AndOr
                  ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
                  children: [
                    (C {<cd>} {(DQ ($ Id.VSub_DollarName '$cli'))})
                    (command.Simple
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {($ Id.VSub_Number '$1')}
                        )
                      ]
                      do_fork: F
                    )
                    (C {<p4>} {<add>} {($ Id.VSub_Number '$1')})
                    (C {<p4>} {<submit>} {<-d>} {(DQ <'Added file '> ($ Id.VSub_Number '$1'))} 
                      {($ Id.VSub_Number '$1')}
                    )
                  ]
                )
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'Add some more files'>)} 
      {
        (SQ <'\n'> <'\tfor i in $(test_seq 0 10)\n'> <'\tdo\n'> <'\t\tp4_add_file "included/x$i" &&\n'> 
          <'\t\tp4_add_file "excluded/x$i"\n'> <'\tdone &&\n'> <'\tfor i in $(test_seq 0 10)\n'> <'\tdo\n'> <'\t\tp4_add_file "excluded/y$i"\n'> 
          <'\tdone\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Syncing files'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit p4 sync --changes-block-size=7 &&\n'> 
          <'\t\tgit checkout p4/master &&\n'> <'\t\tls -l x* > log &&\n'> <'\t\ttest_line_count = 11 log\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Create a repo with multiple depot paths'>)} 
      {
        (SQ <'\n'> <'\tclient_view "//depot/pathA/... //client/pathA/..." \\\n'> 
          <'\t\t    "//depot/pathB/... //client/pathB/..." &&\n'> <'\tmkdir -p "$cli/pathA" "$cli/pathB" &&\n'> <'\tfor p in pathA pathB\n'> <'\tdo\n'> 
          <'\t\tfor i in $(test_seq 1 10)\n'> <'\t\tdo\n'> <'\t\t\tp4_add_file "$p/file$p$i"\n'> <'\t\tdone\n'> <'\tdone\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Clone repo with multiple depot paths'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> 
          <'\t\tgit p4 clone --changes-block-size=4 //depot/pathA@all //depot/pathB@all \\\n'> <'\t\t\t--destination=dest &&\n'> <'\t\tls -1 dest >log &&\n'> <'\t\ttest_line_count = 20 log\n'> 
          <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'kill p4d'>)} {(SQ <'\n'> <'\tkill_p4d\n'>)})
    (C {<test_done>})
  ]
)