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: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Apr 10, 2013 at 01:57 UTC
ddc996d767025a4ffcb52a813d32a5095f357e44
1 file changed
+4
-4
contrib/completion/git-completion.bash
+4
-4
@@ -210,11 +210,11 @@ __gitcomp ()
210
local c i=0 IFS=$' \t\n'
211
for c in $1; do
212
c="$c${4-}"
213
- case $c in
214
- --*=*|*.) ;;
215
- *) c="$c " ;;
216
- esac
213
if [[ $c == "$cur_"* ]]; then
214
+ case $c in
215
+ --*=*|*.) ;;
216
+ *) c="$c " ;;
217
+ esac
218
COMPREPLY[i++]="${2-}$c"
219
fi
220
done