summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-04-24 21:41:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-24 21:41:22 (GMT)
commit745ef0625b0eb93d1be68dd4160d0d85fbb4cc0f (patch)
treed666a8dde318dec6bd1e60c1761724777544c72c /contrib
parent8939cfb5cf576679fe9b533718d5552f71748ee3 (diff)
parent911d5da6f20e28cfe16ea539a4f1b86293a7280e (diff)
downloadgit-745ef0625b0eb93d1be68dd4160d0d85fbb4cc0f.zip
git-745ef0625b0eb93d1be68dd4160d0d85fbb4cc0f.tar.gz
git-745ef0625b0eb93d1be68dd4160d0d85fbb4cc0f.tar.bz2
Merge branch 'fc/completion-tests'
By Felipe Contreras (4) and others * fc/completion-tests: completion: fix completion after 'git --option <TAB>' completion: avoid trailing space for --exec-path completion: add missing general options completion: simplify by using $prev completion: simplify __gitcomp_1 tests: add tests for the __gitcomp() completion helper function tests: add initial bash completion tests
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash22
1 files changed, 13 insertions, 9 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 31f714d..9f56ec7 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
}
@@ -1658,7 +1658,7 @@ _git_notes ()
__gitcomp '--ref'
;;
,*)
- case "${words[cword-1]}" in
+ case "$prev" in
--ref)
__gitcomp_nl "$(__git_refs)"
;;
@@ -1684,7 +1684,7 @@ _git_notes ()
prune,*)
;;
*)
- case "${words[cword-1]}" in
+ case "$prev" in
-m|-F)
;;
*)
@@ -2623,8 +2623,9 @@ _git ()
case "$i" in
--git-dir=*) __git_dir="${i#--git-dir=}" ;;
--bare) __git_dir="." ;;
- --version|-p|--paginate) ;;
--help) command="help"; break ;;
+ -c) c=$((++c)) ;;
+ -*) ;;
*) command="$i"; break ;;
esac
((c++))
@@ -2639,9 +2640,12 @@ _git ()
--bare
--version
--exec-path
+ --exec-path=
--html-path
+ --info-path
--work-tree=
--namespace=
+ --no-replace-objects
--help
"
;;