Skip to content

Commit cdbff7d

Browse files
felipecgitster
authored andcommitted
completion: trivial test improvement
Instead of passing a dummy "", let's check if the last character is a space, and then move the _cword accordingly. Apparently we were passing "" all the way to compgen, which fortunately expanded it to nothing. Lets do the right thing though. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7655fa7 commit cdbff7d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t9902-completion.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ run_completion ()
6969
local -a COMPREPLY _words
7070
local _cword
7171
_words=( $1 )
72+
test "${1: -1}" == ' ' && _words+=('')
7273
(( _cword = ${#_words[@]} - 1 ))
7374
__git_wrap__git_main && print_comp
7475
}
@@ -148,7 +149,7 @@ test_expect_success '__gitcomp - suffix' '
148149
'
149150

150151
test_expect_success 'basic' '
151-
run_completion "git \"\"" &&
152+
run_completion "git " &&
152153
# built-in
153154
grep -q "^add \$" out &&
154155
# script

0 commit comments

Comments
 (0)