(command.CommandList
  children: [
    (C {(test_tristate)} {(GIT_TEST_GIT_DAEMON)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (C {(test)} {(DQ ($ VSub_DollarName '$GIT_TEST_GIT_DAEMON'))} {(Lit_Other '=')} {(false)})
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:skip_all)
                  op: Equal
                  rhs: {(DQ ('git-daemon testing disabled (unset GIT_TEST_GIT_DAEMON to enable)'))}
                )
              ]
            )
            (C {(test_done)})
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [(C {(test_have_prereq)} {(KW_Bang '!') (PIPE)})]
          action: [
            (C {(test_skip_or_die)} {($ VSub_DollarName '$GIT_TEST_GIT_DAEMON')} 
              {(DQ ('file system does not support FIFOs'))}
            )
          ]
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:LIB_GIT_DAEMON_PORT)
          op: Equal
          rhs: 
            {
              (word_part.BracedVarSub
                token: <VSub_Name LIB_GIT_DAEMON_PORT>
                suffix_op: 
                  (suffix_op.StringUnary
                    op_id: VTest_Hyphen
                    arg_word: 
                      {
                        (word_part.BracedVarSub
                          token: <VSub_Name this_test>
                          suffix_op: (suffix_op.StringUnary op_id:VOp1_Pound arg_word:{(t)})
                        )
                      }
                  )
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:GIT_DAEMON_PID) op:Equal rhs:(word.EmptyWord))]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:GIT_DAEMON_DOCUMENT_ROOT_PATH)
          op: Equal
          rhs: {(DQ ($ VSub_DollarName '$PWD')) (/repo)}
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:GIT_DAEMON_URL)
          op: Equal
          rhs: 
            {(git) (Lit_Other ':') (//127.0.0.1) (Lit_Other ':') 
              ($ VSub_DollarName '$LIB_GIT_DAEMON_PORT')
            }
        )
      ]
    )
    (command.FuncDef
      name: start_git_daemon
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-n)} {(DQ ($ VSub_DollarName '$GIT_DAEMON_PID'))})]
                  action: [(C {(error)} {(DQ ('start_git_daemon already called'))})]
                )
              ]
            )
            (C {(mkdir)} {(-p)} {(DQ ($ VSub_DollarName '$GIT_DAEMON_DOCUMENT_ROOT_PATH'))})
            (C {(trap)} {(SQ <'code=$?; stop_git_daemon; (exit $code); die'>)} {(EXIT)})
            (command.SimpleCommand
              words: [{(say)} {(DQ ('Starting git daemon ...'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})]
            )
            (C {(mkfifo)} {(git_daemon_output)})
            (command.Sentence
              child: 
                (command.SimpleCommand
                  words: [
                    {(git)}
                    {(daemon)}
                    {(--listen) (Lit_Other '=') (127.0.0.1)}
                    {(--port) (Lit_Other '=') (DQ ($ VSub_DollarName '$LIB_GIT_DAEMON_PORT'))}
                    {(--reuseaddr)}
                    {(--verbose)}
                    {(--base-path) (Lit_Other '=') 
                      (DQ ($ VSub_DollarName '$GIT_DAEMON_DOCUMENT_ROOT_PATH'))
                    }
                    {(DQ ($ VSub_At '$@'))}
                    {(DQ ($ VSub_DollarName '$GIT_DAEMON_DOCUMENT_ROOT_PATH'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: <Redir_GreatAnd '>&'>
                      fd: 16777215
                      arg_word: {(3)}
                    )
                    (redir.Redir
                      op: <Redir_Great '2>'>
                      fd: 2
                      arg_word: {(git_daemon_output)}
                    )
                  ]
                )
              terminator: <Op_Amp '&'>
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:GIT_DAEMON_PID)
                  op: Equal
                  rhs: {($ VSub_Bang '$!')}
                )
              ]
            )
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.BraceGroup
                  children: [
                    (command.SimpleCommand
                      words: [{(read)} {(line)}]
                      redirects: [(redir.Redir op:<Redir_LessAnd '<&'> fd:16777215 arg_word:{(7)})]
                    )
                    (command.SimpleCommand
                      words: [{(echo)} {(DQ ($ VSub_DollarName '$line'))}]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(4)})]
                    )
                    (command.Sentence
                      child: 
                        (command.SimpleCommand
                          words: [{(cat)}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_LessAnd '<&'>
                              fd: 16777215
                              arg_word: {(7)}
                            )
                            (redir.Redir
                              op: <Redir_GreatAnd '>&'>
                              fd: 16777215
                              arg_word: {(4)}
                            )
                          ]
                        )
                      terminator: <Op_Amp '&'>
                    )
                  ]
                  redirects: [(redir.Redir op:<Redir_Less '7<'> fd:7 arg_word:{(git_daemon_output)})]
                )
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (C {(test)} 
                          {(x) 
                            (DQ 
                              (word_part.CommandSubPart
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {(expr)} {(DQ ($ VSub_DollarName '$line'))} {(Lit_Other ':')} 
                                        {
                                          (DQ (Lit_Other '\\') ('[[0-9]*') (Lit_Other '\\') ('] ') 
                                            (Lit_Other '\\') ('(.*') (Lit_Other '\\') (')')
                                          )
                                        }
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                              )
                            )
                          } {(KW_Bang '!') (Lit_Other '=')} {(x) (DQ ('Ready to rumble'))}
                        )
                      ]
                      action: [
                        (C {(kill)} {(DQ ($ VSub_DollarName '$GIT_DAEMON_PID'))})
                        (C {(wait)} {(DQ ($ VSub_DollarName '$GIT_DAEMON_PID'))})
                        (C {(trap)} {(SQ <die>)} {(EXIT)})
                        (C {(test_skip_or_die)} {($ VSub_DollarName '$GIT_TEST_GIT_DAEMON')} 
                          {(DQ ('git daemon failed to start'))}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: stop_git_daemon
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-z)} {(DQ ($ VSub_DollarName '$GIT_DAEMON_PID'))})]
                  action: [(command.ControlFlow token:<ControlFlow_Return return>)]
                )
              ]
            )
            (C {(trap)} {(SQ <die>)} {(EXIT)})
            (command.SimpleCommand
              words: [{(say)} {(DQ ('Stopping git daemon ...'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})]
            )
            (C {(kill)} {(DQ ($ VSub_DollarName '$GIT_DAEMON_PID'))})
            (command.SimpleCommand
              words: [{(wait)} {(DQ ($ VSub_DollarName '$GIT_DAEMON_PID'))}]
              redirects: [
                (redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})
                (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(4)})
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:ret) op:Equal rhs:{($ VSub_QMark '$?')})]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test_match_signal)} {(15)} {($ VSub_QMark '$?')})]
                  action: [
                    (C {(error)} {(DQ ('git daemon exited with status: ') ($ VSub_DollarName '$ret'))})
                  ]
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:GIT_DAEMON_PID) op:Equal rhs:(word.EmptyWord))]
            )
            (C {(rm)} {(-f)} {(git_daemon_output)})
          ]
        )
    )
  ]
)