diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-07-13 16:41:02 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-07-13 16:41:02 -0700 |
commit | 10ce0209b69cebc32d9bfbe78067c752952425cc (patch) | |
tree | b7eb78d16d3eb4733418a76ac88709d456e573f3 /contrib | |
parent | git-request-pull: replace call to deprecated peek-remote (diff) | |
parent | bash completion: Don't offer "a.." as a completion for "a." (diff) | |
download | tgif-10ce0209b69cebc32d9bfbe78067c752952425cc.tar.xz |
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
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/completion/git-completion.bash | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 84a256ec54..d268e6f0b3 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -114,9 +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 @@ __gitcomp () 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 @@ __git_complete_revlist () cur="${cur#*..}" __gitcomp "$(__git_refs)" "$pfx" "$cur" ;; - *.) - __gitcomp "$cur." - ;; *) __gitcomp "$(__git_refs)" ;; |