From: Felipe Contreras Date: Wed, 10 Apr 2013 06:57:57 +0000 (-0500) Subject: completion: small optimization X-Git-Tag: v1.8.3-rc0~59^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ddc996d767025a4ffcb52a813d32a5095f357e44?ds=sidebyside 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 Signed-off-by: Junio C Hamano --- diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index f38579214f..6df62c2173 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -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