From: Junio C Hamano Date: Thu, 7 Feb 2013 23:15:23 +0000 (-0800) Subject: Merge branch 'jc/do-not-let-random-file-interfere-with-completion-tests' into maint X-Git-Tag: v1.8.1.3~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/696c35972fdb0b80e68e61fba4055f29777ca3a9?ds=inline;hp=-c Merge branch 'jc/do-not-let-random-file-interfere-with-completion-tests' into maint Scripts to test bash completion was inherently flaky as it was affected by whatever random things the user may have on $PATH. * jc/do-not-let-random-file-interfere-with-completion-tests: t9902: protect test from stray build artifacts --- 696c35972fdb0b80e68e61fba4055f29777ca3a9 diff --combined contrib/completion/git-completion.bash index 468c96c4a2,6139b50113..2186b4b77e --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -397,7 -397,7 +397,7 @@@ __git_complete_revlist_file ( *) pfx="$ref:$pfx" ;; esac - __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ + __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \ | sed '/^100... blob /{ s,^.* ,, s,$, , @@@ -531,10 -531,19 +531,19 @@@ __git_complete_strategy ( return 1 } + __git_commands () { + if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}" + then + printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" + else + git help -a|egrep '^ [a-zA-Z0-9]' + fi + } + __git_list_all_commands () { local i IFS=" "$'\n' - for i in $(git help -a|egrep '^ [a-zA-Z0-9]') + for i in $(__git_commands) do case $i in *--*) : helper pattern;; @@@ -2431,7 -2440,7 +2440,7 @@@ if [[ -n ${ZSH_VERSION-} ]]; the --*=*|*.) ;; *) c="$c " ;; esac - array+=("$c") + array[$#array+1]="$c" done compset -P '*[=:]' compadd -Q -S '' -p "${2-}" -a -- array && _ret=0