]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t9902-completion.sh: old Bash still does not support array+=('') notation
authorBrandon Casey <drafnel@gmail.com>
Wed, 21 Aug 2013 20:49:32 +0000 (13:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Aug 2013 23:38:50 +0000 (16:38 -0700)
Old Bash (3.0) which is distributed with RHEL 4.X and other ancient
platforms that are still in wide use, does not understand the
array+=() notation.  Let's use an explicit assignment to the new array
element which works everywhere, like:

   array[${#array[@]}+1]=''

The right-hand side '' is not strictly necessary, but in this case
I think it is more clear.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t9902-completion.sh

index 272a071e85b0b7c6b34da06fd7492a257b09fa52..2d4beb5e50c257fed2f4b6475cb5834425b5a64f 100755 (executable)
@@ -69,7 +69,7 @@ run_completion ()
        local -a COMPREPLY _words
        local _cword
        _words=( $1 )
-       test "${1: -1}" = ' ' && _words+=('')
+       test "${1: -1}" = ' ' && _words[${#_words[@]}+1]=''
        (( _cword = ${#_words[@]} - 1 ))
        __git_wrap__git_main && print_comp
 }