(command.CommandList
  children: [
    (C {(test_tristate)} {(GIT_TEST_GIT_DAEMON)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (C {(test)} {(DQ ($ Id.VSub_DollarName '$GIT_TEST_GIT_DAEMON'))} {(Id.Lit_Equals '=')} 
              {(false)}
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: {(DQ ('git-daemon testing disabled (unset GIT_TEST_GIT_DAEMON to enable)'))}
                  spids: [71]
                )
              ]
            )
            (C {(test_done)})
          ]
          spids: [56 68]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [(C {(test_have_prereq)} {(Id.KW_Bang '!') (PIPE)})]
          action: [
            (C {(test_skip_or_die)} {($ Id.VSub_DollarName '$GIT_TEST_GIT_DAEMON')} 
              {(DQ ('file system does not support FIFOs'))}
            )
          ]
          spids: [82 89]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LIB_GIT_DAEMON_PORT)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: (Token id:Id.VSub_Name val:LIB_GIT_DAEMON_PORT span_id:105)
                suffix_op: 
                  (suffix_op.Unary
                    op_id: Id.VTest_Hyphen
                    arg_word: 
                      {
                        (braced_var_sub
                          token: (Token id:Id.VSub_Name val:this_test span_id:108)
                          suffix_op: (suffix_op.Unary op_id:Id.VOp1_Pound arg_word:{(t)})
                        )
                      }
                  )
              )
            }
          spids: [103]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_DAEMON_PID)
          op: assign_op.Equal
          rhs: (word.Empty)
          spids: [115]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_DAEMON_DOCUMENT_ROOT_PATH)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$PWD')) (/repo)}
          spids: [117]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_DAEMON_URL)
          op: assign_op.Equal
          rhs: 
            {(git) (Id.Lit_Other ':') (//127.0.0.1) (Id.Lit_Other ':') 
              ($ Id.VSub_DollarName '$LIB_GIT_DAEMON_PORT')
            }
          spids: [123]
        )
      ]
    )
    (command.ShFunction
      name: start_git_daemon
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_PID'))})]
                  action: [(C {(error)} {(DQ ('start_git_daemon already called'))})]
                  spids: [138 149]
                )
              ]
            )
            (C {(mkdir)} {(-p)} {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_DOCUMENT_ROOT_PATH'))})
            (C {(trap)} 
              {
                (SQ 
                  (Token
                    id: Id.Lit_Chars
                    val: 'code=$?; stop_git_daemon; (exit $code); die'
                    span_id: 176
                  )
                )
              } {(EXIT)}
            )
            (command.Simple
              words: [{(say)} {(DQ ('Starting git daemon ...'))}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:185)
                  fd: -1
                  arg_word: {(3)}
                )
              ]
            )
            (C {(mkfifo)} {(git_daemon_output)})
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {(git)}
                    {(daemon)}
                    {(--listen) (Id.Lit_Equals '=') (127.0.0.1)}
                    {(--port) (Id.Lit_Equals '=') (DQ ($ Id.VSub_DollarName '$LIB_GIT_DAEMON_PORT'))}
                    {(--reuseaddr)}
                    {(--verbose)}
                    {(--base-path) (Id.Lit_Equals '=') 
                      (DQ ($ Id.VSub_DollarName '$GIT_DAEMON_DOCUMENT_ROOT_PATH'))
                    }
                    {(DQ ($ Id.VSub_At '$@'))}
                    {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_DOCUMENT_ROOT_PATH'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:238)
                      fd: -1
                      arg_word: {(3)}
                    )
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'2>' span_id:241)
                      fd: 2
                      arg_word: {(git_daemon_output)}
                    )
                  ]
                )
              terminator: (Token id:Id.Op_Amp val:'&' span_id:244)
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:GIT_DAEMON_PID)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Bang '$!')}
                  spids: [247]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.BraceGroup
                  children: [
                    (command.Simple
                      words: [{(read)} {(line)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_LessAnd val:'<&' span_id:258)
                          fd: -1
                          arg_word: {(7)}
                        )
                      ]
                    )
                    (command.Simple
                      words: [{(echo)} {(DQ ($ Id.VSub_DollarName '$line'))}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:264)
                          fd: -1
                          arg_word: {(4)}
                        )
                      ]
                    )
                    (command.Sentence
                      child: 
                        (command.Simple
                          words: [{(cat)}]
                          redirects: [
                            (redir.Redir
                              op: (Token id:Id.Redir_LessAnd val:'<&' span_id:274)
                              fd: -1
                              arg_word: {(7)}
                            )
                            (redir.Redir
                              op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:277)
                              fd: -1
                              arg_word: {(4)}
                            )
                          ]
                        )
                      terminator: (Token id:Id.Op_Amp val:'&' span_id:280)
                    )
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Less val:'7<' span_id:285)
                      fd: 7
                      arg_word: {(git_daemon_output)}
                    )
                  ]
                )
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (C {(test)} 
                          {(x) 
                            (DQ 
                              (command_sub
                                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:302)
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {(expr)} {(DQ ($ Id.VSub_DollarName '$line'))} 
                                        {(Id.Lit_Other ':')} 
                                        {
                                          (DQ (Id.Lit_Other '\\') ('[[0-9]*') (Id.Lit_Other '\\') ('] ') 
                                            (Id.Lit_Other '\\') ('(.*') (Id.Lit_Other '\\') (')')
                                          )
                                        }
                                      )
                                    ]
                                  )
                              )
                            )
                          } {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(x) (DQ ('Ready to rumble'))}
                        )
                      ]
                      action: [
                        (C {(kill)} {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_PID'))})
                        (C {(wait)} {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_PID'))})
                        (C {(trap)} {(SQ (Token id:Id.Lit_Chars val:die span_id:353))} {(EXIT)})
                        (C {(test_skip_or_die)} {($ Id.VSub_DollarName '$GIT_TEST_GIT_DAEMON')} 
                          {(DQ ('git daemon failed to start'))}
                        )
                      ]
                      spids: [296 333]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: stop_git_daemon
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_PID'))})]
                  action: [
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Return val:return span_id:396)
                    )
                  ]
                  spids: [382 393]
                )
              ]
            )
            (C {(trap)} {(SQ (Token id:Id.Lit_Chars val:die span_id:406))} {(EXIT)})
            (command.Simple
              words: [{(say)} {(DQ ('Stopping git daemon ...'))}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:419)
                  fd: -1
                  arg_word: {(3)}
                )
              ]
            )
            (C {(kill)} {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_PID'))})
            (command.Simple
              words: [{(wait)} {(DQ ($ Id.VSub_DollarName '$GIT_DAEMON_PID'))}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:440)
                  fd: -1
                  arg_word: {(3)}
                )
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:443)
                  fd: 2
                  arg_word: {(4)}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:ret)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [447]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test_match_signal)} {(15)} {($ Id.VSub_QMark '$?')})]
                  action: [
                    (C {(error)} 
                      {(DQ ('git daemon exited with status: ') ($ Id.VSub_DollarName '$ret'))}
                    )
                  ]
                  spids: [451 460]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:GIT_DAEMON_PID)
                  op: assign_op.Equal
                  rhs: (word.Empty)
                  spids: [474]
                )
              ]
            )
            (C {(rm)} {(-f)} {(git_daemon_output)})
          ]
        )
    )
  ]
)