From: Junio C Hamano Date: Sun, 13 Jul 2008 23:41:02 +0000 (-0700) Subject: Merge branch 'sp/maint-bash-completion-optim' X-Git-Tag: v1.6.0-rc0~79 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/10ce0209b69cebc32d9bfbe78067c752952425cc?ds=inline;hp=-c Merge branch 'sp/maint-bash-completion-optim' * sp/maint-bash-completion-optim: bash completion: Don't offer "a.." as a completion for "a." bash completion: Improve responsiveness of git-log completion --- 10ce0209b69cebc32d9bfbe78067c752952425cc diff --combined contrib/completion/git-completion.bash index 84a256ec54,821c9a7f9f..d268e6f0b3 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -114,9 -114,20 +114,20 @@@ __git_ps1 ( fi } + __gitcomp_1 () + { + 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 " ;; + esac + done + } + __gitcomp () { - local all c s=$'\n' IFS=' '$'\t'$'\n' local cur="${COMP_WORDS[COMP_CWORD]}" if [ $# -gt 2 ]; then cur="$3" @@@ -124,21 -135,14 +135,14 @@@ case "$cur" in --*=) COMPREPLY=() - return ;; *) - for c in $1; do - case "$c$4" in - --*=*) all="$all$c$4$s" ;; - *.) all="$all$c$4$s" ;; - *) all="$all$c$4 $s" ;; - esac - done + local IFS=$'\n' + COMPREPLY=($(compgen -P "$2" \ + -W "$(__gitcomp_1 "$1" "$4")" \ + -- "$cur")) ;; esac - IFS=$s - COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur")) - return } __git_heads () @@@ -320,9 -324,6 +324,6 @@@ __git_complete_revlist ( cur="${cur#*..}" __gitcomp "$(__git_refs)" "$pfx" "$cur" ;; - *.) - __gitcomp "$cur." - ;; *) __gitcomp "$(__git_refs)" ;; @@@ -527,7 -528,7 +528,7 @@@ _git_bisect ( { __git_has_doubledash && return - local subcommands="start bad good reset visualize replay log" + local subcommands="start bad good skip reset visualize replay log run" local subcommand="$(__git_find_subcommand "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" @@@ -535,7 -536,7 +536,7 @@@ fi case "$subcommand" in - bad|good|reset) + bad|good|reset|skip) __gitcomp "$(__git_refs)" ;; *) @@@ -562,7 -563,7 +563,7 @@@ _git_branch ( --*) __gitcomp " --color --no-color --verbose --abbrev= --no-abbrev - --track --no-track + --track --no-track --contains --merged --no-merged " ;; *) @@@ -784,9 -785,6 +785,9 @@@ _git_log ( --not --all --left-right --cherry-pick --graph + --stat --numstat --shortstat + --decorate --diff-filter= + --color-words --walk-reflogs " return ;; @@@ -1063,6 -1061,7 +1064,6 @@@ _git_config ( pull.octopus pull.twohead repack.useDeltaBaseOffset - show.difftree showbranch.default tar.umask transfer.unpackLimit @@@ -1071,6 -1070,7 +1072,6 @@@ user.name user.email user.signingkey - whatchanged.difftree branch. remote. " } @@@ -1163,19 -1163,8 +1164,19 @@@ _git_show ( _git_stash () { local subcommands='save list show apply clear drop pop create' - if [ -z "$(__git_find_subcommand "$subcommands")" ]; then + local subcommand="$(__git_find_subcommand "$subcommands")" + if [ -z "$subcommand" ]; then __gitcomp "$subcommands" + else + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$subcommand,$cur" in + save,--*) + __gitcomp "--keep-index" + ;; + *) + COMPREPLY=() + ;; + esac fi }