summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2013-04-10 01:57:57 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-04-14 23:18:58 -0700
commitddc996d767025a4ffcb52a813d32a5095f357e44 (patch)
tree20e970bd65b82eada4e559a47d72a18813c58bd5 /contrib/completion
parentcompletion: inline __gitcomp_1 to its sole callsite (diff)
downloadtgif-ddc996d767025a4ffcb52a813d32a5095f357e44.tar.xz
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>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.bash8
1 files changed, 4 insertions, 4 deletions
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