提交 ddc996d7 编写于 作者: F Felipe Contreras 提交者: Junio C Hamano

completion: small optimization

No need to calculate a new $c with a space if we are not going to do
anything it with it.

There should be no functional changes, except that a word "foo " with no
suffixes can't be matched. But $cur cannot have a space at the end
anyway. So it's safe.

Based on the code from SZEDER Gábor.
Signed-off-by: NFelipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b4cfbc96
......@@ -210,11 +210,11 @@ __gitcomp ()
local c i=0 IFS=$' \t\n'
for c in $1; do
c="$c${4-}"
case $c in
--*=*|*.) ;;
*) c="$c " ;;
esac
if [[ $c == "$cur_"* ]]; then
case $c in
--*=*|*.) ;;
*) c="$c " ;;
esac
COMPREPLY[i++]="${2-}$c"
fi
done
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册