(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'fetch/push involving alternates'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: count_objects
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:loose)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [22]
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:inpack)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [25]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<eval>} 
                  {
                    (DQ 
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<git>} {<count-objects>} {<-v>})
                              (C {<sed>} {<-n>} {<-e>} {(SQ <'s/^count: \\(.*\\)/loose=\\1/p'>)} {<-e>} 
                                {(SQ <'s/^in-pack: \\(.*\\)/inpack=\\1/p'>)}
                              )
                            ]
                            negated: F
                          )
                      )
                    )
                  }
                )
                (C {<echo>} 
                  {
                    (word_part.ArithSub
                      anode: 
                        (arith_expr.Binary
                          op_id: Id.Arith_Plus
                          left: {($ Id.VSub_DollarName '$loose')}
                          right: {($ Id.VSub_DollarName '$inpack')}
                        )
                    )
                  }
                )
              ]
            )
          ]
        )
    )
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tgit init original &&\n'> <'\t\tcd original &&\n'> <'\t\ti=0 &&\n'> 
          <'\t\twhile test $i -le 100\n'> <'\t\tdo\n'> <'\t\t\techo "$i" >count &&\n'> <'\t\t\tgit add count &&\n'> 
          <'\t\t\tgit commit -m "$i" || exit\n'> <'\t\t\ti=$(($i + 1))\n'> <'\t\tdone\n'> <'\t) &&\n'> <'\t(\n'> 
          <'\t\tgit clone --reference=original "file://$(pwd)/original" one &&\n'> <'\t\tcd one &&\n'> <'\t\techo Z >count &&\n'> <'\t\tgit add count &&\n'> <'\t\tgit commit -m Z &&\n'> 
          <'\t\tcount_objects >../one.count\n'> <'\t) &&\n'> <'\tA=$(pwd)/original/.git/objects &&\n'> <'\tgit init receiver &&\n'> 
          <'\techo "$A" >receiver/.git/objects/info/alternates &&\n'> <'\tgit init fetcher &&\n'> <'\techo "$A" >fetcher/.git/objects/info/alternates\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'pushing into a repository with the same alternate'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit push ../receiver master:refs/heads/it\n'> 
          <'\t) &&\n'> <'\t(\n'> <'\t\tcd receiver &&\n'> <'\t\tcount_objects >../receiver.count\n'> <'\t) &&\n'> 
          <'\ttest_cmp one.count receiver.count\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'fetching from a repository with the same alternate'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd fetcher &&\n'> <'\t\tgit fetch ../one master:refs/heads/it &&\n'> 
          <'\t\tcount_objects >../fetcher.count\n'> <'\t) &&\n'> <'\ttest_cmp one.count fetcher.count\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)