diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2020-10-27 04:14:39 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 11:14:39 +0100 |
commit | d05544562532fdf4d5f4a4d4eba01f4263e17cc7 (patch) | |
tree | 65b86e34ec6a722cc533456ab3a4a3f078f6f746 | |
parent | bad9ee00042cc7f63f5271646d31e531a9e8c48c (diff) | |
download | zsh-d05544562532fdf4d5f4a4d4eba01f4263e17cc7.tar.gz zsh-d05544562532fdf4d5f4a4d4eba01f4263e17cc7.tar.bz2 zsh-d05544562532fdf4d5f4a4d4eba01f4263e17cc7.zip |
gitfast: fetch latest fixes from git-completion (#9390)
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
-rw-r--r-- | plugins/gitfast/_git | 33 | ||||
-rw-r--r-- | plugins/gitfast/git-completion.bash | 6 |
2 files changed, 22 insertions, 17 deletions
diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git index 6ca63ed87..aaea581d5 100644 --- a/plugins/gitfast/_git +++ b/plugins/gitfast/_git @@ -27,19 +27,26 @@ zstyle -T ':completion:*:*:git:*' tag-order && \ zstyle -s ":completion:*:*:git:*" script script if [ -z "$script" ]; then local -a locations - local e + local e bash_completion + + bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) || + bash_completion='/usr/share/bash-completion/completions/' + locations=( "$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash "$HOME/.local/share/bash-completion/completions/git" - "$(pkg-config --variable=completionsdir bash-completion)"/git - '/usr/share/bash-completion/completions/git' + "$bash_completion/git" '/etc/bash_completion.d/git' # old debian ) for e in $locations; do test -f $e && script="$e" && break done fi + +local old_complete="$functions[complete]" +functions[complete]=: GIT_SOURCING_ZSH_COMPLETION=y . "$script" +functions[complete]="$old_complete" __gitcomp () { @@ -105,26 +112,26 @@ __gitcomp_nl () compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0 } -__gitcomp_nl_append () +__gitcomp_file () { emulate -L zsh - compset -P '*[=:]' - compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0 + compadd -f -p "${2-}" -- ${(f)1} && _ret=0 } -__gitcomp_file_direct () +__gitcomp_direct_append () { - emulate -L zsh - - compadd -f -- ${(f)1} && _ret=0 + __gitcomp_direct "$@" } -__gitcomp_file () +__gitcomp_nl_append () { - emulate -L zsh + __gitcomp_nl "$@" +} - compadd -f -p "${2-}" -- ${(f)1} && _ret=0 +__gitcomp_file_direct () +{ + __gitcomp_file "$1" "" } _git_zsh () diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 76ba7e79f..b93706d17 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -3585,7 +3585,6 @@ __git_func_wrap () # This is NOT a public function; use at your own risk. __git_complete () { - test -n "$ZSH_VERSION" && return local wrapper="__git_wrap${2}" eval "$wrapper () { __git_func_wrap $2 ; }" complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \ @@ -3607,8 +3606,7 @@ if ! git --list-cmds=main >/dev/null 2>&1; then { case "$1" in --list-cmds=*) - IFS=, read -r -a cmds <<< "${1##--list-cmds=}" - for x in ${cmds[@]}; do + while read -r -d ',' x; do case "$x" in nohelpers) ;; @@ -3620,7 +3618,7 @@ if ! git --list-cmds=main >/dev/null 2>&1; then echo ${__git_cmds[$x]} ;; esac - done + done <<< "${1##--list-cmds=}," return ;; esac |