(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'test bash completion'>)} ) ] ) (C {(.)} {(./lib-bash.sh)}) (command.FuncDef name: complete body: (command.BraceGroup children: [(command.ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] ) ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_TESTING_COMMAND_COMPLETION) op: Equal rhs: {(SQ <'add checkout check-attr filter-branch ls-files'>)} ) ] ) (C {(.)} {(DQ ($ VSub_DollarName '$GIT_BUILD_DIR') (/contrib/completion/git-completion.bash))}) (command.FuncDef name: _get_comp_words_by_ref body: (command.BraceGroup children: [ (command.WhileUntil keyword: <KW_While while> cond: [ (command.Sentence child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-gt)} {(0)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(cur)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cur) op: Equal rhs: { (word_part.BracedVarSub token: <VSub_Name _words> bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithVarRef token: <Lit_ArithVarLike _cword> ) ) ) } ) ] ) ] ) (case_arm pat_list: [{(prev)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:prev) op: Equal rhs: { (word_part.BracedVarSub token: <VSub_Name _words> bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithBinary op_id: Arith_Minus left: (arith_expr.ArithVarRef token: <Lit_ArithVarLike _cword> ) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) ) } ) ] ) ] ) (case_arm pat_list: [{(words)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:words) op: Equal rhs: { (word_part.ArrayLiteralPart words: [ { (DQ (word_part.BracedVarSub token: <VSub_Name _words> bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) ) } ] ) } ) ] ) ] ) (case_arm pat_list: [{(cword)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cword) op: Equal rhs: {($ VSub_DollarName '$_cword')} ) ] ) ] ) ] ) (C {(shift)}) ] ) ) ] ) ) (command.FuncDef name: print_comp body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:IFS) op: Equal rhs: { (word_part.SingleQuotedPart left: <Left_DollarSingleQuote "$'"> tokens: [<Char_OneChar '\\n'>] ) } ) ] ) (command.SimpleCommand words: [ {(echo)} { (DQ (word_part.BracedVarSub token: <VSub_Name COMPREPLY> bracket_op: (bracket_op.WholeArray op_id:Arith_Star) ) ) } ] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(out)})] ) ] ) ) (command.FuncDef name: run_completion body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_Local flags: [-a] pairs: [ (assign_pair lhs:(lhs_expr.LhsName name:COMPREPLY) op:Equal) (assign_pair lhs:(lhs_expr.LhsName name:_words) op:Equal) ] ) (command.Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(lhs_expr.LhsName name:_cword) op:Equal)] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:_words) op: Equal rhs: {(word_part.ArrayLiteralPart words:[{($ VSub_Number '$1')}])} ) ] ) (command.AndOr ops: [Op_DAmp] children: [ (C {(test)} { (DQ (word_part.BracedVarSub token: <VSub_Number 1> suffix_op: (suffix_op.Slice begin: (arith_expr.ArithUnary op_id: Node_UnaryMinus child: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) ) ) } {(Lit_Other '=')} {(SQ <' '>)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsIndexedName name: _words index: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithWord w: { (word_part.BracedVarSub token: <VSub_Name _words> prefix_op: VSub_Pound bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) } ) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) op: Equal rhs: {(SQ )} ) ] ) ] ) (command.DParen child: (arith_expr.BinaryAssign op_id: Arith_Equal left: (lhs_expr.LhsName name:_cword) right: (arith_expr.ArithBinary op_id: Arith_Minus left: (arith_expr.ArithWord w: { (word_part.BracedVarSub token: <VSub_Name _words> prefix_op: VSub_Pound bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) } ) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) ) (command.AndOr ops: [Op_DAmp] children: [(C {(__git_wrap__git_main)}) (C {(print_comp)})] ) ] ) ) (command.FuncDef name: test_completion body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (command.If arms: [ (if_arm cond: [(C {(test)} {($ VSub_Pound '$#')} {(-gt)} {(1)})] action: [ (command.SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_Number '$2'))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(expected)} ) ] ) ] ) ] else_action: [ (command.SimpleCommand words: [{(sed)} {(-e)} {(SQ <'s/Z$//'>)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) ] ) (C {(run_completion)} {(DQ ($ VSub_Number '$1'))}) (C {(test_cmp)} {(expected)} {(out)}) ] ) ] ) ) (command.FuncDef name: test_gitcomp body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (command.Assignment keyword: Assign_Local flags: [-a] pairs: [(assign_pair lhs:(lhs_expr.LhsName name:COMPREPLY) op:Equal)] ) (command.SimpleCommand words: [{(sed)} {(-e)} {(SQ <'s/Z$//'>)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cur) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} ) ] ) (C {(shift)}) (C {(__gitcomp)} {(DQ ($ VSub_At '$@'))}) (C {(print_comp)}) (C {(test_cmp)} {(expected)} {(out)}) ] ) ] ) ) (command.FuncDef name: test_gitcomp_nl body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (command.Assignment keyword: Assign_Local flags: [-a] pairs: [(assign_pair lhs:(lhs_expr.LhsName name:COMPREPLY) op:Equal)] ) (command.SimpleCommand words: [{(sed)} {(-e)} {(SQ <'s/Z$//'>)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cur) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} ) ] ) (C {(shift)}) (C {(__gitcomp_nl)} {(DQ ($ VSub_At '$@'))}) (C {(print_comp)}) (C {(test_cmp)} {(expected)} {(out)}) ] ) ] ) ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:invalid_variable_name) op: Equal rhs: {(SQ <'${foo.bar}'>)} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:actual) op: Equal rhs: {(DQ ($ VSub_DollarName '$TRASH_DIRECTORY') (/actual))} ) ] ) (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'> ) } ) (command.FuncDef name: pwd_P_W body: (command.BraceGroup children: [ (command.If arms: [(if_arm cond:[(C {(test_have_prereq)} {(MINGW)})] action:[(C {(pwd)} {(-W)})])] else_action: [(C {(pwd)} {(-P)})] ) ] ) ) (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'>)} ) (command.SimpleCommand words: [{(read)} {(-r)} {(-d)} {(DQ )} {(refs)}] redirects: [ (redir.HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)} here_end_span_id: 1027 stdin_parts: [('maint\n') ('master\n') ('next\n') ('pu\n')] ) ] ) (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)}) ] )