(command.CommandList
  children: [
    (command.ShFunction
      name: gitweb_init
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:safe_pwd)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:26)
                          command_list: 
                            (command.CommandList
                              children: [
                                (C {(perl)} {(-MPOSIX) (Id.Lit_Equals '=') (getcwd)} {(-e)} 
                                  {
                                    (SQ 
                                      (Token
                                        id: Id.Lit_Chars
                                        val: 'print quotemeta(getcwd)'
                                        span_id: 36
                                      )
                                    )
                                  }
                                )
                              ]
                            )
                        )
                      )
                    }
                  spids: [24]
                )
              ]
            )
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:44)
                  fd: -1
                  arg_word: {(gitweb_config.perl)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:47)
                  fd: -1
                  here_begin: {(EOF)}
                  here_end_span_id: 115
                  stdin_parts: [
                    ('#!/usr/bin/perl\n')
                    ('\n')
                    ('# gitweb configuration for tests\n')
                    ('\n')
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:55)
                    )
                    ("version = 'current';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:58)
                    )
                    ("GIT = 'git';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:61)
                    )
                    ('projectroot = ')
                    (Id.Right_DoubleQuote '"')
                    ($ Id.VSub_DollarName '$safe_pwd')
                    (Id.Right_DoubleQuote '"')
                    (';\n')
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:68)
                    )
                    ('project_maxdepth = 8;\n')
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:71)
                    )
                    ("home_link_str = 'projects';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:74)
                    )
                    ("site_name = '[localhost]';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:77)
                    )
                    ("site_html_head_string = '';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:80)
                    )
                    ("site_header = '';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:83)
                    )
                    ("site_footer = '';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:86)
                    )
                    ("home_text = 'indextext.html';\n")
                    ("our @stylesheets = ('file:///")
                    ($ Id.VSub_DollarName '$GIT_BUILD_DIR')
                    ("/gitweb/static/gitweb.css');\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:92)
                    )
                    ("logo = 'file:///")
                    ($ Id.VSub_DollarName '$GIT_BUILD_DIR')
                    ("/gitweb/static/git-logo.png';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:97)
                    )
                    ("favicon = 'file:///")
                    ($ Id.VSub_DollarName '$GIT_BUILD_DIR')
                    ("/gitweb/static/git-favicon.png';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:102)
                    )
                    ("projects_list = '';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:105)
                    )
                    ("export_ok = '';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:108)
                    )
                    ("strict_export = '';\n")
                    ('our ')
                    (word_part.EscapedLiteral
                      token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:111)
                    )
                    ('maxload = undef;\n')
                    ('\n')
                  ]
                )
              ]
            )
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:120)
                  fd: -1
                  arg_word: {(.git/description)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:123)
                  fd: -1
                  here_begin: {(EOF)}
                  here_end_span_id: 129
                  stdin_parts: [($ Id.VSub_Number '$0') (' test repository\n')]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$GITWEB_TEST_INSTALLED'))})
                      terminator: (Token id:Id.Op_Semi val:';' span_id:158)
                    )
                  ]
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(test)} {(-d)} {($ Id.VSub_DollarName '$GITWEB_TEST_INSTALLED')})
                              terminator: (Token id:Id.Op_Semi val:';' span_id:170)
                            )
                          ]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:SCRIPT_NAME)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (DQ ($ Id.VSub_DollarName '$GITWEB_TEST_INSTALLED') 
                                        (/gitweb.cgi)
                                      )
                                    }
                                  spids: [175]
                                )
                              ]
                            )
                          ]
                          spids: [163 172]
                        )
                      ]
                      else_action: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:SCRIPT_NAME)
                              op: assign_op.Equal
                              rhs: {(DQ ($ Id.VSub_DollarName '$GITWEB_TEST_INSTALLED'))}
                              spids: [185]
                            )
                          ]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {(test)} {(-f)} {(DQ ($ Id.VSub_DollarName '$SCRIPT_NAME'))})
                        (C {(error)} 
                          {
                            (DQ ('Cannot find gitweb at ') 
                              ($ Id.VSub_DollarName '$GITWEB_TEST_INSTALLED') (.)
                            )
                          }
                        )
                      ]
                    )
                    (C {(say)} {(DQ ('# Testing ') ($ Id.VSub_DollarName '$SCRIPT_NAME'))})
                  ]
                  spids: [148 160]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:SCRIPT_NAME)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_DollarName '$GIT_BUILD_DIR') (/gitweb/gitweb.perl))}
                      spids: [228]
                    )
                  ]
                )
              ]
            )
            (C {(export)} {(SCRIPT_NAME)})
          ]
        )
    )
    (command.ShFunction
      name: gitweb_run
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:GATEWAY_INTERFACE)
                  op: assign_op.Equal
                  rhs: {(SQ (Token id:Id.Lit_Chars val:CGI/1.1 span_id:255))}
                  spids: [253]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:HTTP_ACCEPT)
                  op: assign_op.Equal
                  rhs: {(SQ (Token id:Id.Lit_Chars val:'*/*' span_id:261))}
                  spids: [259]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:REQUEST_METHOD)
                  op: assign_op.Equal
                  rhs: {(SQ (Token id:Id.Lit_Chars val:GET span_id:267))}
                  spids: [265]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:QUERY_STRING)
                  op: assign_op.Equal
                  rhs: {(DQ ) ($ Id.VSub_Number '$1') (DQ )}
                  spids: [271]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:PATH_INFO)
                  op: assign_op.Equal
                  rhs: {(DQ ) ($ Id.VSub_Number '$2') (DQ )}
                  spids: [279]
                )
              ]
            )
            (C {(export)} {(GATEWAY_INTERFACE)} {(HTTP_ACCEPT)} {(REQUEST_METHOD)} {(QUERY_STRING)} 
              {(PATH_INFO)}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:GITWEB_CONFIG)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:304)
                        command_list: (command.CommandList children:[(C {(pwd)})])
                      ) (/gitweb_config.perl)
                    }
                  spids: [303]
                )
              ]
            )
            (C {(export)} {(GITWEB_CONFIG)})
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(rm)} {(-f)} {(gitweb.log)})
                (command.Simple
                  words: [{(perl)} {(--)} {(DQ ($ Id.VSub_DollarName '$SCRIPT_NAME'))}]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:347)
                      fd: -1
                      arg_word: {(gitweb.output)}
                    )
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'2>' span_id:350)
                      fd: 2
                      arg_word: {(gitweb.log)}
                    )
                  ]
                )
                (C {(perl)} {(-w)} {(-e)} 
                  {
                    (SQ (Token id:Id.Lit_Chars val:'\n' span_id:363) 
                      (Token
                        id: Id.Lit_Chars
                        val: '\t\topen O, ">gitweb.headers";\n'
                        span_id: 364
                      ) (Token id:Id.Lit_Chars val:'\t\twhile (<>) {\n' span_id:365) 
                      (Token
                        id: Id.Lit_Chars
                        val: '\t\t\tprint O;\n'
                        span_id: 366
                      ) (Token id:Id.Lit_Chars val:'\t\t\tlast if (/^\\r$/ || /^$/);\n' span_id:367) 
                      (Token id:Id.Lit_Chars val:'\t\t}\n' span_id:368) (Token id:Id.Lit_Chars val:'\t\topen O, ">gitweb.body";\n' span_id:369) 
                      (Token
                        id: Id.Lit_Chars
                        val: '\t\twhile (<>) {\n'
                        span_id: 370
                      ) (Token id:Id.Lit_Chars val:'\t\t\tprint O;\n' span_id:371) 
                      (Token id:Id.Lit_Chars val:'\t\t}\n' span_id:372) (Token id:Id.Lit_Chars val:'\t\tclose O;\n' span_id:373) (Token id:Id.Lit_Chars val:'\t' span_id:374)
                    )
                  } {(gitweb.output)}
                )
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.Simple
                              words: [
                                {(grep)}
                                {(SQ (Token id:Id.Lit_Chars val:'^[[]' span_id:387))}
                                {(gitweb.log)}
                              ]
                              redirects: [
                                (redir.Redir
                                  op: (Token id:Id.Redir_Great val:'>' span_id:392)
                                  fd: -1
                                  arg_word: {(/dev/null)}
                                )
                                (redir.Redir
                                  op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:395)
                                  fd: 2
                                  arg_word: {(1)}
                                )
                              ]
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:397)
                        )
                      ]
                      action: [
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {(test_debug)} 
                              {(SQ (Token id:Id.Lit_Chars val:'cat gitweb.log >&2' span_id:405))}
                            )
                            (C {(false)})
                          ]
                        )
                      ]
                      spids: [382 399]
                    )
                  ]
                  else_action: [(C {(true)})]
                )
              ]
            )
          ]
        )
    )
    (C {(.)} {(./test-lib.sh)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.Pipeline children:[(C {(test_have_prereq)} {(PERL)})] negated:T)
              terminator: (Token id:Id.Op_Semi val:';' span_id:454)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (SQ 
                        (Token
                          id: Id.Lit_Chars
                          val: 'skipping gitweb tests, perl not available'
                          span_id: 461
                        )
                      )
                    }
                  spids: [459]
                )
              ]
            )
            (C {(test_done)})
          ]
          spids: [447 456]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [
            {(perl)}
            {(-MEncode)}
            {(-e)}
            {(SQ (Token id:Id.Lit_Chars val:'$e="";decode_utf8($e, Encode::FB_CROAK)' span_id:477))}
          ]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:480)
              fd: -1
              arg_word: {(/dev/null)}
            )
            (redir.Redir
              op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:483)
              fd: 2
              arg_word: {(1)}
            )
          ]
        )
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (SQ 
                        (Token
                          id: Id.Lit_Chars
                          val: 'skipping gitweb tests, perl version is too old'
                          span_id: 493
                        )
                      )
                    }
                  spids: [491]
                )
              ]
            )
            (C {(test_done)})
          ]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [
            {(perl)}
            {(-MCGI)}
            {(-MCGI) (Id.Lit_Other ':') (Id.Lit_Other ':') (Util)}
            {(-MCGI) (Id.Lit_Other ':') (Id.Lit_Other ':') (Carp)}
            {(-e)}
            {(0)}
          ]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:520)
              fd: -1
              arg_word: {(/dev/null)}
            )
            (redir.Redir
              op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:523)
              fd: 2
              arg_word: {(1)}
            )
          ]
        )
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (SQ 
                        (Token
                          id: Id.Lit_Chars
                          val: 'skipping gitweb tests, CGI module unusable'
                          span_id: 533
                        )
                      )
                    }
                  spids: [531]
                )
              ]
            )
            (C {(test_done)})
          ]
        )
      ]
    )
    (C {(gitweb_init)})
  ]
)