Merge branch 'jc/do-not-let-random-file-interfere-with-completion-tests'
authorJunio C Hamano <gitster@pobox.com>
Fri, 1 Feb 2013 20:39:46 +0000 (12:39 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Feb 2013 20:39:46 +0000 (12:39 -0800)
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

1  2 
contrib/completion/git-completion.bash
index 8c49ce25443c531fb11243d8faf19010a209e970,6139b5011352cfe0af3414c7d2c1eb2cb55925b0..5770b6f2d01c6d08c337a2901bba276f3d99f2d0
@@@ -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