Skip to content

Commit 0ef0970

Browse files
drafnelgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5d5812f commit 0ef0970

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t9902-completion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ run_completion ()
6969
local -a COMPREPLY _words
7070
local _cword
7171
_words=( $1 )
72-
test "${1: -1}" = ' ' && _words+=('')
72+
test "${1: -1}" = ' ' && _words[${#_words[@]}+1]=''
7373
(( _cword = ${#_words[@]} - 1 ))
7474
__git_wrap__git_main && print_comp
7575
}

0 commit comments

Comments
 (0)