Merge branch 'jc/do-not-let-random-file-interfere-with-completion-tests' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 7 Feb 2013 23:15:23 +0000 (15:15 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Feb 2013 23:15:23 +0000 (15:15 -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 468c96c4a214b4572327a682ddbd7cb9d96aa008,6139b5011352cfe0af3414c7d2c1eb2cb55925b0..2186b4b77e1bc415e2d92ff6b68b1af8cc170a7e
@@@ -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