diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-04-24 14:41:22 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-24 14:41:22 -0700 |
commit | 745ef0625b0eb93d1be68dd4160d0d85fbb4cc0f (patch) | |
tree | d666a8dde318dec6bd1e60c1761724777544c72c /contrib | |
parent | Merge branch 'cc/fix-missing-va-end-in-revert' (diff) | |
parent | completion: fix completion after 'git --option <TAB>' (diff) | |
download | tgif-745ef0625b0eb93d1be68dd4160d0d85fbb4cc0f.tar.xz |
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-x | contrib/completion/git-completion.bash | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 31f714da92..9f56ec7a6b 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 " ;; |