From: Junio C Hamano Date: Fri, 1 Feb 2013 20:39:46 +0000 (-0800) Subject: Merge branch 'jc/do-not-let-random-file-interfere-with-completion-tests' X-Git-Tag: v1.8.2-rc0~69 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/51a1d232a7c1bc6bbdb4ac47ab2e91ad3873b25b?ds=inline;hp=-c Merge branch 'jc/do-not-let-random-file-interfere-with-completion-tests' 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 --- 51a1d232a7c1bc6bbdb4ac47ab2e91ad3873b25b diff --combined contrib/completion/git-completion.bash index 8c49ce2544,6139b50113..5770b6f2d0 --- 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;; @@@ -563,7 -572,6 +572,7 @@@ __git_list_porcelain_commands ( archimport) : import;; cat-file) : plumbing;; check-attr) : plumbing;; + check-ignore) : plumbing;; check-ref-format) : plumbing;; checkout-index) : plumbing;; commit-tree) : plumbing;; @@@ -2432,7 -2440,7 +2441,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