t9902-completion.sh: old Bash still does not support array+=('') notation

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>

Brandon Casey committed Aug 21, 2013 at 13:49 UTC 0ef09702d6b7fbd225d1e7adeca7b32304be529f
1 file changed +1 -1
t/t9902-completion.sh
+1 -1
@@ -69,7 +69,7 @@ run_completion ()
69 local -a COMPREPLY _words
70 local _cword
71 _words=( $1 )
72 - test "${1: -1}" = ' ' && _words+=('')
72 + test "${1: -1}" = ' ' && _words[${#_words[@]}+1]=''
73 (( _cword = ${#_words[@]} - 1 ))
74 __git_wrap__git_main && print_comp
75 }