Skip to content

Commit ddc996d

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b4cfbc9 commit ddc996d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/completion/git-completion.bash

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ __gitcomp ()
210210
local c i=0 IFS=$' \t\n'
211211
for c in $1; do
212212
c="$c${4-}"
213-
case $c in
214-
--*=*|*.) ;;
215-
*) c="$c " ;;
216-
esac
217213
if [[ $c == "$cur_"* ]]; then
214+
case $c in
215+
--*=*|*.) ;;
216+
*) c="$c " ;;
217+
esac
218218
COMPREPLY[i++]="${2-}$c"
219219
fi
220220
done

0 commit comments

Comments
 (0)