summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2012-04-15 22:44:16 +0300
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-04-21 22:39:06 -0700
commit3bf421ea624fb083ea4d88fd487ae8b7b8bae06a (patch)
tree1e327eb3a21479a27267b36244af15f470dc6146
parenttests: add tests for the __gitcomp() completion helper function (diff)
downloadtgif-3bf421ea624fb083ea4d88fd487ae8b7b8bae06a.tar.xz
completion: simplify __gitcomp_1
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xcontrib/completion/git-completion.bash12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 31f714da92..db2d3cc3fd 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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
}