completion: simplify __gitcomp_1
authorFelipe Contreras <felipe.contreras@gmail.com>
Sun, 15 Apr 2012 19:44:16 +0000 (22:44 +0300)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Apr 2012 05:39:06 +0000 (22:39 -0700)
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 31f714da927511fb5b2b7ac11dd7af1e3f98ae76..db2d3cc3fde3490eeb8724ce56b77babce235f14 100755 (executable)
@@ -304,16 +304,16 @@ __git_ps1 ()
        fi
 }
 
-# __gitcomp_1 requires 2 arguments
 __gitcomp_1 ()
 {
-       local c IFS=' '$'\t'$'\n'
+       local c IFS=$' \t\n'
        for c in $1; do
-               case "$c$2" in
-               --*=*) printf %s$'\n' "$c$2" ;;
-               *.)    printf %s$'\n' "$c$2" ;;
-               *)     printf %s$'\n' "$c$2 " ;;
+               c="$c$2"
+               case $c in
+               --*=*|*.) ;;
+               *) c="$c " ;;
                esac
+               printf '%s\n' "$c"
        done
 }