(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'test bash completion'>)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./lib-bash.sh)})
    (FuncDef
      name: complete
      body: 
        (BraceGroup
          children: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})]
          spids: [29]
        )
      spids: [24 28]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:GIT_TESTING_COMMAND_COMPLETION)
          op: Equal
          rhs: {(SQ <'add checkout check-attr filter-branch ls-files'>)}
          spids: [92]
        )
      ]
      spids: [92]
    )
    (C {(.)} {(DQ ($ VSub_Name '$GIT_BUILD_DIR') (/contrib/completion/git-completion.bash))})
    (FuncDef
      name: _get_comp_words_by_ref
      body: 
        (BraceGroup
          children: [
            (While
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-gt)} {(0)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (DoGroup
                  children: [
                    (Case
                      to_match: {(DQ ($ VSub_Number '$1'))}
                      arms: [
                        (case_arm
                          pat_list: [{(cur)}]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:cur)
                                  op: Equal
                                  rhs: 
                                    {
                                      (BracedVarSub
                                        token: <VSub_Name _words>
                                        bracket_op: (ArrayIndex expr:(ArithVarRef name:_cword))
                                        spids: [153 158]
                                      )
                                    }
                                  spids: [152]
                                )
                              ]
                              spids: [152]
                            )
                          ]
                          spids: [148 149 161 -1]
                        )
                        (case_arm
                          pat_list: [{(prev)}]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:prev)
                                  op: Equal
                                  rhs: 
                                    {
                                      (BracedVarSub
                                        token: <VSub_Name _words>
                                        bracket_op: 
                                          (ArrayIndex
                                            expr: 
                                              (ArithBinary
                                                op_id: Arith_Minus
                                                left: (ArithVarRef name:_cword)
                                                right: (ArithWord w:{(Lit_Digits 1)})
                                              )
                                          )
                                        spids: [169 176]
                                      )
                                    }
                                  spids: [168]
                                )
                              ]
                              spids: [168]
                            )
                          ]
                          spids: [164 165 179 -1]
                        )
                        (case_arm
                          pat_list: [{(words)}]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:words)
                                  op: Equal
                                  rhs: 
                                    {
                                      (ArrayLiteralPart
                                        words: [
                                          {
                                            (DQ 
                                              (BracedVarSub
                                                token: <VSub_Name _words>
                                                bracket_op: (WholeArray op_id:Lit_At)
                                                spids: [189 194]
                                              )
                                            )
                                          }
                                        ]
                                      )
                                    }
                                  spids: [186]
                                )
                              ]
                              spids: [186]
                            )
                          ]
                          spids: [182 183 199 -1]
                        )
                        (case_arm
                          pat_list: [{(cword)}]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:cword)
                                  op: Equal
                                  rhs: {($ VSub_Name '$_cword')}
                                  spids: [206]
                                )
                              ]
                              spids: [206]
                            )
                          ]
                          spids: [202 203 210 -1]
                        )
                      ]
                      spids: [139 145 213]
                    )
                    (C {(shift)})
                  ]
                  spids: [136 219]
                )
            )
          ]
          spids: [120]
        )
      spids: [115 119]
    )
    (FuncDef
      name: print_comp
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:IFS)
                  op: Equal
                  rhs: {(SQ <Lit_EscapedChar '\\n'>)}
                  spids: [234]
                )
              ]
              spids: [232]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ 
                    (BracedVarSub
                      token: <VSub_Name COMPREPLY>
                      bracket_op: (WholeArray op_id:Arith_Star)
                      spids: [243 248]
                    )
                  )
                }
              ]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(out)} spids:[251])]
            )
          ]
          spids: [229]
        )
      spids: [224 228]
    )
    (FuncDef
      name: run_completion
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              flags: ["'-a'"]
              pairs: [
                (assign_pair lhs:(LhsName name:COMPREPLY) op:Equal spids:[270])
                (assign_pair lhs:(LhsName name:_words) op:Equal spids:[272])
              ]
              spids: [266]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:_cword) op:Equal spids:[277])]
              spids: [275]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:_words)
                  op: Equal
                  rhs: {(ArrayLiteralPart words:[{($ VSub_Number '$1')}])}
                  spids: [280]
                )
              ]
              spids: [280]
            )
            (AndOr
              children: [
                (C {(test)} 
                  {
                    (DQ 
                      (BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: 
                          (Slice
                            begin: 
                              (ArithUnary
                                op_id: Node_UnaryMinus
                                child: (ArithWord w:{(Lit_Digits 1)})
                              )
                          )
                        spids: [291 297]
                      )
                    )
                  } {(Lit_Other '=')} {(SQ <' '>)}
                )
                (C 
                  {(_words) (Lit_Other '[') 
                    (BracedVarSub
                      token: <VSub_Name _words>
                      prefix_op: VSub_Pound
                      bracket_op: (WholeArray op_id:Lit_At)
                      spids: [310 316]
                    ) (Lit_Other '+') (1) (Lit_Other ']') (Lit_Other '=') (SQ )
                  }
                )
              ]
              op_id: Op_DAmp
            )
            (DParen
              child: 
                (BinaryAssign
                  op_id: Arith_Equal
                  left: (LhsName name:_cword)
                  right: 
                    (ArithBinary
                      op_id: Arith_Minus
                      left: 
                        (ArithWord
                          w: 
                            {
                              (BracedVarSub
                                token: <VSub_Name _words>
                                prefix_op: VSub_Pound
                                bracket_op: (WholeArray op_id:Lit_At)
                                spids: [331 337]
                              )
                            }
                        )
                      right: (ArithWord w:{(Lit_Digits 1)})
                    )
                )
            )
            (AndOr
              children: [(C {(__git_wrap__git_main)}) (C {(print_comp)})]
              op_id: Op_DAmp
            )
          ]
          spids: [263]
        )
      spids: [258 262]
    )
    (FuncDef
      name: test_completion
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (If
                  arms: [
                    (if_arm
                      cond: [(C {(test)} {($ VSub_Pound '$#')} {(-gt)} {(1)})]
                      action: [
                        (SimpleCommand
                          words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_Number '$2'))}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(expected)}
                              spids: [400]
                            )
                          ]
                        )
                      ]
                      spids: [-1 387]
                    )
                  ]
                  else_action: [
                    (SimpleCommand
                      words: [{(sed)} {(-e)} {(SQ <'s/Z$//'>)}]
                      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[415])]
                    )
                  ]
                  spids: [404 419]
                )
                (AndOr
                  children: [
                    (C {(run_completion)} {(DQ ($ VSub_Number '$1'))})
                    (C {(test_cmp)} {(expected)} {(out)})
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [373]
        )
      spids: [368 372]
    )
    (FuncDef
      name: test_gitcomp
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (Assignment
                  keyword: Assign_Local
                  flags: ["'-a'"]
                  pairs: [(assign_pair lhs:(LhsName name:COMPREPLY) op:Equal spids:[466])]
                  spids: [462]
                )
                (AndOr
                  children: [
                    (SimpleCommand
                      words: [{(sed)} {(-e)} {(SQ <'s/Z$//'>)}]
                      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[479])]
                    )
                    (AndOr
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:cur)
                              op: Equal
                              rhs: {(DQ ($ VSub_Number '$1'))}
                              spids: [485]
                            )
                          ]
                          spids: [485]
                        )
                        (AndOr
                          children: [
                            (C {(shift)})
                            (AndOr
                              children: [
                                (C {(__gitcomp)} {(DQ ($ VSub_At '$@'))})
                                (AndOr
                                  children: [(C {(print_comp)}) (C {(test_cmp)} {(expected)} {(out)})]
                                  op_id: Op_DAmp
                                )
                              ]
                              op_id: Op_DAmp
                            )
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [459]
        )
      spids: [454 458]
    )
    (FuncDef
      name: test_gitcomp_nl
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (Assignment
                  keyword: Assign_Local
                  flags: ["'-a'"]
                  pairs: [(assign_pair lhs:(LhsName name:COMPREPLY) op:Equal spids:[545])]
                  spids: [541]
                )
                (AndOr
                  children: [
                    (SimpleCommand
                      words: [{(sed)} {(-e)} {(SQ <'s/Z$//'>)}]
                      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[558])]
                    )
                    (AndOr
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:cur)
                              op: Equal
                              rhs: {(DQ ($ VSub_Number '$1'))}
                              spids: [564]
                            )
                          ]
                          spids: [564]
                        )
                        (AndOr
                          children: [
                            (C {(shift)})
                            (AndOr
                              children: [
                                (C {(__gitcomp_nl)} {(DQ ($ VSub_At '$@'))})
                                (AndOr
                                  children: [(C {(print_comp)}) (C {(test_cmp)} {(expected)} {(out)})]
                                  op_id: Op_DAmp
                                )
                              ]
                              op_id: Op_DAmp
                            )
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [538]
        )
      spids: [533 537]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:invalid_variable_name)
          op: Equal
          rhs: {(SQ <'${foo.bar}'>)}
          spids: [600]
        )
      ]
      spids: [600]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:actual)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/actual))}
          spids: [606]
        )
      ]
      spids: [606]
    )
    (C {(test_expect_success)} {(SQ <'setup for __gitdir tests'>)} 
      {(SQ <'\n'> <'\tmkdir -p subdir/subsubdir &&\n'> <'\tgit init otherrepo\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - from command line (through $__git_dir)'>)} 
      {
        (SQ <'\n'> <'\techo "$TRASH_DIRECTORY/otherrepo/.git" >expected &&\n'> <'\t(\n'> 
          <'\t\t__git_dir="$TRASH_DIRECTORY/otherrepo/.git" &&\n'> <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - repo as argument'>)} 
      {
        (SQ <'\n'> <'\techo "otherrepo/.git" >expected &&\n'> 
          <'\t__gitdir "otherrepo" >"$actual" &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - remote as argument'>)} 
      {
        (SQ <'\n'> <'\techo "remote" >expected &&\n'> <'\t__gitdir "remote" >"$actual" &&\n'> 
          <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - .git directory in cwd'>)} 
      {
        (SQ <'\n'> <'\techo ".git" >expected &&\n'> <'\t__gitdir >"$actual" &&\n'> 
          <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - .git directory in parent'>)} 
      {
        (SQ <'\n'> <'\techo "$(pwd -P)/.git" >expected &&\n'> <'\t(\n'> <'\t\tcd subdir/subsubdir &&\n'> 
          <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - cwd is a .git directory'>)} 
      {
        (SQ <'\n'> <'\techo "." >expected &&\n'> <'\t(\n'> <'\t\tcd .git &&\n'> 
          <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - parent is a .git directory'>)} 
      {
        (SQ <'\n'> <'\techo "$(pwd -P)/.git" >expected &&\n'> <'\t(\n'> <'\t\tcd .git/refs/heads &&\n'> 
          <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - $GIT_DIR set while .git directory in cwd'>)} 
      {
        (SQ <'\n'> <'\techo "$TRASH_DIRECTORY/otherrepo/.git" >expected &&\n'> <'\t(\n'> 
          <'\t\tGIT_DIR="$TRASH_DIRECTORY/otherrepo/.git" &&\n'> <'\t\texport GIT_DIR &&\n'> <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> 
          <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - $GIT_DIR set while .git directory in parent'>)} 
      {
        (SQ <'\n'> <'\techo "$TRASH_DIRECTORY/otherrepo/.git" >expected &&\n'> <'\t(\n'> 
          <'\t\tGIT_DIR="$TRASH_DIRECTORY/otherrepo/.git" &&\n'> <'\t\texport GIT_DIR &&\n'> <'\t\tcd subdir &&\n'> <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> 
          <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - non-existing $GIT_DIR'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tGIT_DIR="$TRASH_DIRECTORY/non-existing" &&\n'> 
          <'\t\texport GIT_DIR &&\n'> <'\t\ttest_must_fail __gitdir\n'> <'\t)\n'>
        )
      }
    )
    (FuncDef
      name: pwd_P_W
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [(C {(test_have_prereq)} {(MINGW)})]
                  action: [(C {(pwd)} {(-W)})]
                  spids: [-1 806]
                )
              ]
              else_action: [(C {(pwd)} {(-P)})]
              spids: [814 822]
            )
          ]
          spids: [796]
        )
      spids: [789 795]
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - gitfile in cwd'>)} 
      {
        (SQ <'\n'> <'\techo "$(pwd_P_W)/otherrepo/.git" >expected &&\n'> 
          <'\techo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&\n'> <'\ttest_when_finished "rm -f subdir/.git" &&\n'> <'\t(\n'> <'\t\tcd subdir &&\n'> 
          <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - gitfile in parent'>)} 
      {
        (SQ <'\n'> <'\techo "$(pwd_P_W)/otherrepo/.git" >expected &&\n'> 
          <'\techo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&\n'> <'\ttest_when_finished "rm -f subdir/.git" &&\n'> <'\t(\n'> <'\t\tcd subdir/subsubdir &&\n'> 
          <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SYMLINKS)} {(SQ <'__gitdir - resulting path avoids symlinks'>)} 
      {
        (SQ <'\n'> <'\techo "$(pwd -P)/otherrepo/.git" >expected &&\n'> <'\tmkdir otherrepo/dir &&\n'> 
          <'\ttest_when_finished "rm -rf otherrepo/dir" &&\n'> <'\tln -s otherrepo/dir link &&\n'> <'\ttest_when_finished "rm -f link" &&\n'> <'\t(\n'> 
          <'\t\tcd link &&\n'> <'\t\t__gitdir >"$actual"\n'> <'\t) &&\n'> <'\ttest_cmp expected "$actual"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitdir - not a git repository'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd subdir/subsubdir &&\n'> 
          <'\t\tGIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY" &&\n'> <'\t\texport GIT_CEILING_DIRECTORIES &&\n'> <'\t\ttest_must_fail __gitdir\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp - trailing space - options'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp "--re" "--dry-run --reuse-message= --reedit-message=\n'> 
          <'\t\t--reset-author" <<-EOF\n'> <'\t--reuse-message=Z\n'> <'\t--reedit-message=Z\n'> <'\t--reset-author Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp - trailing space - config keys'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp "br" "branch. branch.autosetupmerge\n'> 
          <'\t\tbranch.autosetuprebase browser." <<-\\EOF\n'> <'\tbranch.Z\n'> <'\tbranch.autosetupmerge Z\n'> <'\tbranch.autosetuprebase Z\n'> <'\tbrowser.Z\n'> 
          <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp - option parameter'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp "--strategy=re" "octopus ours recursive resolve subtree" \\\n'> 
          <'\t\t"" "re" <<-\\EOF\n'> <'\trecursive Z\n'> <'\tresolve Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp - prefix'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp "branch.me" "remote merge mergeoptions rebase" \\\n'> 
          <'\t\t"branch.maint." "me" <<-\\EOF\n'> <'\tbranch.maint.merge Z\n'> <'\tbranch.maint.mergeoptions Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp - suffix'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp "branch.me" "master maint next pu" "branch." \\\n'> 
          <'\t\t"ma" "." <<-\\EOF\n'> <'\tbranch.master.Z\n'> <'\tbranch.maint.Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp - doesnt fail because of invalid variable name'>)} 
      {(SQ <'\n'> <'\t__gitcomp "$invalid_variable_name"\n'>)}
    )
    (SimpleCommand
      words: [{(read)} {(-r)} {(-d)} {(DQ )} {(refs)}]
      redirects: [
        (HereDoc
          op_id: Redir_DLessDash
          fd: -1
          body: {('maint\n') ('master\n') ('next\n') ('pu\n')}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [1011]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp_nl - trailing space'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp_nl "m" "$refs" <<-EOF\n'> <'\tmaint Z\n'> <'\tmaster Z\n'> 
          <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp_nl - prefix'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp_nl "--fixup=m" "$refs" "--fixup=" "m" <<-EOF\n'> 
          <'\t--fixup=maint Z\n'> <'\t--fixup=master Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp_nl - suffix'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp_nl "branch.ma" "$refs" "branch." "ma" "." <<-\\EOF\n'> 
          <'\tbranch.maint.Z\n'> <'\tbranch.master.Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp_nl - no suffix'>)} 
      {
        (SQ <'\n'> <'\ttest_gitcomp_nl "ma" "$refs" "" "ma" "" <<-\\EOF\n'> <'\tmaintZ\n'> 
          <'\tmasterZ\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'__gitcomp_nl - doesnt fail because of invalid variable name'>)} 
      {(SQ <'\n'> <'\t__gitcomp_nl "$invalid_variable_name"\n'>)}
    )
    (C {(test_expect_success)} 
      {(SQ <'__git_remotes - list remotes from $GIT_DIR/remotes and from config file'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tremote_from_file_1\n'> <'\tremote_from_file_2\n'> 
          <'\tremote_in_config_1\n'> <'\tremote_in_config_2\n'> <'\tEOF\n'> <'\ttest_when_finished "rm -rf .git/remotes" &&\n'> 
          <'\tmkdir -p .git/remotes &&\n'> <'\t>.git/remotes/remote_from_file_1 &&\n'> <'\t>.git/remotes/remote_from_file_2 &&\n'> 
          <'\ttest_when_finished "git remote remove remote_in_config_1" &&\n'> <'\tgit remote add remote_in_config_1 git://remote_1 &&\n'> 
          <'\ttest_when_finished "git remote remove remote_in_config_2" &&\n'> <'\tgit remote add remote_in_config_2 git://remote_2 &&\n'> <'\t__git_remotes >actual &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <__git_get_config_variables>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tname-1\n'> <'\tname-2\n'> <'\tEOF\n'> 
          <'\ttest_config interesting.name-1 good &&\n'> <'\ttest_config interesting.name-2 good &&\n'> 
          <'\ttest_config subsection.interesting.name-3 bad &&\n'> <'\t__git_get_config_variables interesting >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <__git_pretty_aliases>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tauthor\n'> <'\thash\n'> <'\tEOF\n'> 
          <'\ttest_config pretty.author "%an %ae" &&\n'> <'\ttest_config pretty.hash %H &&\n'> <'\t__git_pretty_aliases >actual &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <__git_aliases>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tci\n'> <'\tco\n'> <'\tEOF\n'> 
          <'\ttest_config alias.ci commit &&\n'> <'\ttest_config alias.co checkout &&\n'> <'\t__git_aliases >actual &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <basic>)} 
      {
        (SQ <'\n'> <'\trun_completion "git " &&\n'> <'\t# built-in\n'> <'\tgrep -q "^add \\$" out &&\n'> 
          <'\t# script\n'> <'\tgrep -q "^filter-branch \\$" out &&\n'> <'\t# plumbing\n'> <'\t! grep -q "^ls-files \\$" out &&\n'> 
          <'\n'> <'\trun_completion "git f" &&\n'> <'\t! grep -q -v "^f" out\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'double dash "git" itself'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git --" <<-\\EOF\n'> <'\t--paginate Z\n'> <'\t--no-pager Z\n'> 
          <'\t--git-dir=\n'> <'\t--bare Z\n'> <'\t--version Z\n'> <'\t--exec-path Z\n'> <'\t--exec-path=\n'> <'\t--html-path Z\n'> 
          <'\t--man-path Z\n'> <'\t--info-path Z\n'> <'\t--work-tree=\n'> <'\t--namespace=\n'> <'\t--no-replace-objects Z\n'> 
          <'\t--help Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'double dash "git checkout"'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git checkout --" <<-\\EOF\n'> <'\t--quiet Z\n'> <'\t--ours Z\n'> 
          <'\t--theirs Z\n'> <'\t--track Z\n'> <'\t--no-track Z\n'> <'\t--merge Z\n'> <'\t--conflict=\n'> <'\t--orphan Z\n'> 
          <'\t--patch Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'general options'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git --ver" "--version " &&\n'> 
          <'\ttest_completion "git --hel" "--help " &&\n'> <'\ttest_completion "git --exe" <<-\\EOF &&\n'> <'\t--exec-path Z\n'> <'\t--exec-path=\n'> <'\tEOF\n'> 
          <'\ttest_completion "git --htm" "--html-path " &&\n'> <'\ttest_completion "git --pag" "--paginate " &&\n'> 
          <'\ttest_completion "git --no-p" "--no-pager " &&\n'> <'\ttest_completion "git --git" "--git-dir=" &&\n'> 
          <'\ttest_completion "git --wor" "--work-tree=" &&\n'> <'\ttest_completion "git --nam" "--namespace=" &&\n'> <'\ttest_completion "git --bar" "--bare " &&\n'> 
          <'\ttest_completion "git --inf" "--info-path " &&\n'> <'\ttest_completion "git --no-r" "--no-replace-objects "\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'general options plus command'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git --version check" "checkout " &&\n'> 
          <'\ttest_completion "git --paginate check" "checkout " &&\n'> <'\ttest_completion "git --git-dir=foo check" "checkout " &&\n'> 
          <'\ttest_completion "git --bare check" "checkout " &&\n'> <'\ttest_completion "git --exec-path=foo check" "checkout " &&\n'> 
          <'\ttest_completion "git --html-path check" "checkout " &&\n'> <'\ttest_completion "git --no-pager check" "checkout " &&\n'> 
          <'\ttest_completion "git --work-tree=foo check" "checkout " &&\n'> <'\ttest_completion "git --namespace=foo check" "checkout " &&\n'> 
          <'\ttest_completion "git --paginate check" "checkout " &&\n'> <'\ttest_completion "git --info-path check" "checkout " &&\n'> 
          <'\ttest_completion "git --no-replace-objects check" "checkout "\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'git --help completion'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git --help ad" "add " &&\n'> 
          <'\ttest_completion "git --help core" "core-tutorial "\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'setup for ref completion'>)} 
      {
        (SQ <'\n'> <'\techo content >file1 &&\n'> <'\techo more >file2 &&\n'> <'\tgit add . &&\n'> 
          <'\tgit commit -m one &&\n'> <'\tgit branch mybranch &&\n'> <'\tgit tag mytag\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'checkout completes ref names'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git checkout m" <<-\\EOF\n'> <'\tmaster Z\n'> <'\tmybranch Z\n'> 
          <'\tmytag Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'show completes all refs'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git show m" <<-\\EOF\n'> <'\tmaster Z\n'> <'\tmybranch Z\n'> 
          <'\tmytag Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'<ref>: completes paths'>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git show mytag:f" <<-\\EOF\n'> <'\tfile1 Z\n'> <'\tfile2 Z\n'> 
          <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'complete tree filename with spaces'>)} 
      {
        (SQ <'\n'> <'\techo content >"name with spaces" &&\n'> <'\tgit add . &&\n'> 
          <'\tgit commit -m spaces &&\n'> <'\ttest_completion "git show HEAD:nam" <<-\\EOF\n'> <'\tname with spaces Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'complete tree filename with metacharacters'>)} 
      {
        (SQ <'\n'> <'\techo content >"name with \\${meta}" &&\n'> <'\tgit add . &&\n'> 
          <'\tgit commit -m meta &&\n'> <'\ttest_completion "git show HEAD:nam" <<-\\EOF\n'> <'\tname with ${meta} Z\n'> 
          <'\tname with spaces Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <send-email>)} 
      {
        (SQ <'\n'> <'\ttest_completion "git send-email --cov" "--cover-letter " &&\n'> 
          <'\ttest_completion "git send-email ma" "master "\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'complete files'>)} 
      {
        (SQ <'\n'> <'\tgit init tmp && cd tmp &&\n'> 
          <'\ttest_when_finished "cd .. && rm -rf tmp" &&\n'> <'\n'> <'\techo "expected" > .gitignore &&\n'> <'\techo "out" >> .gitignore &&\n'> <'\n'> 
          <'\tgit add .gitignore &&\n'> <'\ttest_completion "git commit " ".gitignore" &&\n'> <'\n'> <'\tgit commit -m ignore &&\n'> <'\n'> 
          <'\ttouch new &&\n'> <'\ttest_completion "git add " "new" &&\n'> <'\n'> <'\tgit add new &&\n'> 
          <'\tgit commit -a -m new &&\n'> <'\ttest_completion "git add " "" &&\n'> <'\n'> <'\tgit mv new modified &&\n'> 
          <'\techo modify > modified &&\n'> <'\ttest_completion "git add " "modified" &&\n'> <'\n'> <'\ttouch untracked &&\n'> <'\n'> 
          <'\t: TODO .gitignore should not be here &&\n'> <'\ttest_completion "git rm " <<-\\EOF &&\n'> <'\t.gitignore\n'> <'\tmodified\n'> <'\tEOF\n'> <'\n'> 
          <'\ttest_completion "git clean " "untracked" &&\n'> <'\n'> <'\t: TODO .gitignore should not be here &&\n'> <'\ttest_completion "git mv " <<-\\EOF &&\n'> 
          <'\t.gitignore\n'> <'\tmodified\n'> <'\tEOF\n'> <'\n'> <'\tmkdir dir &&\n'> <'\ttouch dir/file-in-dir &&\n'> 
          <'\tgit add dir/file-in-dir &&\n'> <'\tgit commit -m dir &&\n'> <'\n'> <'\tmkdir untracked-dir &&\n'> <'\n'> 
          <'\t: TODO .gitignore should not be here &&\n'> <'\ttest_completion "git mv modified " <<-\\EOF &&\n'> <'\t.gitignore\n'> <'\tdir\n'> <'\tmodified\n'> 
          <'\tuntracked\n'> <'\tuntracked-dir\n'> <'\tEOF\n'> <'\n'> <'\ttest_completion "git commit " "modified" &&\n'> <'\n'> 
          <'\t: TODO .gitignore should not be here &&\n'> <'\ttest_completion "git ls-files " <<-\\EOF &&\n'> <'\t.gitignore\n'> <'\tdir\n'> <'\tmodified\n'> 
          <'\tEOF\n'> <'\n'> <'\ttouch momified &&\n'> <'\ttest_completion "git add mom" "momified"\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(DQ ("completion uses <cmd> completion for alias: !sh -c 'git <cmd> ...'"))} 
      {(SQ <'\n'> <'\ttest_config alias.co "!sh -c '>) (DQ ("'")) (SQ <'git checkout ...'>) (DQ ("'")) 
        (SQ <'" &&\n'> <'\ttest_completion "git co m" <<-\\EOF\n'> <'\tmaster Z\n'> <'\tmybranch Z\n'> 
          <'\tmytag Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'completion uses <cmd> completion for alias: !f () { VAR=val git <cmd> ... }'>)} 
      {
        (SQ <'\n'> <'\ttest_config alias.co "!f () { VAR=val git checkout ... ; } f" &&\n'> 
          <'\ttest_completion "git co m" <<-\\EOF\n'> <'\tmaster Z\n'> <'\tmybranch Z\n'> <'\tmytag Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'completion used <cmd> completion for alias: !f() { : git <cmd> ; ... }'>)} 
      {
        (SQ <'\n'> <'\ttest_config alias.co "!f() { : git checkout ; if ... } f" &&\n'> 
          <'\ttest_completion "git co m" <<-\\EOF\n'> <'\tmaster Z\n'> <'\tmybranch Z\n'> <'\tmytag Z\n'> <'\tEOF\n'>
        )
      }
    )
    (C {(test_expect_failure)} {(SQ <'complete with tilde expansion'>)} 
      {
        (SQ <'\n'> <'\tgit init tmp && cd tmp &&\n'> 
          <'\ttest_when_finished "cd .. && rm -rf tmp" &&\n'> <'\n'> <'\ttouch ~/tmp/file &&\n'> <'\n'> <'\ttest_completion "git add ~/tmp/" "~/tmp/file"\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)