mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-25 15:58:57 +01:00
fix(gitfast): update to git-completion 1.3.6 (#10633)
This commit is contained in:
parent
3c5367d272
commit
6f9650d940
@ -33,8 +33,9 @@ if [ -z "$script" ]; then
|
||||
bash_completion='/usr/share/bash-completion/completions/'
|
||||
|
||||
locations=(
|
||||
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
|
||||
"${${funcsourcetrace[1]%:*}:A:h}"/git-completion.bash
|
||||
"$HOME/.local/share/bash-completion/completions/git"
|
||||
'/usr/local/share/bash-completion/completions/git'
|
||||
"$bash_completion/git"
|
||||
'/etc/bash_completion.d/git' # old debian
|
||||
)
|
||||
@ -51,13 +52,20 @@ functions[complete]="$old_complete"
|
||||
|
||||
__gitcompadd ()
|
||||
{
|
||||
compadd -Q -p "${2-}" -S "${3- }" ${@[4,-1]} -- ${=1} && _ret=0
|
||||
compadd -p "${2-}" -S "${3- }" -q -- ${=1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
IFS=$' \t\n' __gitcompadd "$1" "${2-}" "${4- }"
|
||||
}
|
||||
|
||||
__gitcomp_opts ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
local cur_="${3-$cur}"
|
||||
|
||||
[[ "$cur_" == *= ]] && return
|
||||
@ -70,7 +78,7 @@ __gitcomp ()
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ -z "${4-}" ]]; then
|
||||
if [[ -z "${4+set}" ]]; then
|
||||
case $c in
|
||||
*=) c="${c%=}"; sfx="=" ;;
|
||||
*.) sfx="" ;;
|
||||
@ -79,7 +87,7 @@ __gitcomp ()
|
||||
else
|
||||
sfx="$4"
|
||||
fi
|
||||
__gitcompadd "$c" "${2-}" "$sfx" -q
|
||||
__gitcompadd "$c" "${2-}" "$sfx"
|
||||
done
|
||||
}
|
||||
|
||||
@ -87,7 +95,10 @@ __gitcomp_nl ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
IFS=$'\n' __gitcompadd "$1" "${2-}" "${4- }"
|
||||
# words that don't end up in space
|
||||
compadd -p "${2-}" -S "${4- }" -q -- ${${(f)1}:#*\ } && _ret=0
|
||||
# words that end in space
|
||||
compadd -p "${2-}" -S " ${4- }" -q -- ${${(M)${(f)1}:#*\ }% } && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_file ()
|
||||
@ -107,21 +118,6 @@ __gitcomp_file_direct ()
|
||||
__gitcomp_file "$1" ""
|
||||
}
|
||||
|
||||
__gitcomp_nl_append ()
|
||||
{
|
||||
__gitcomp_nl "$@"
|
||||
}
|
||||
|
||||
__gitcomp_direct_append ()
|
||||
{
|
||||
__gitcomp_direct "$@"
|
||||
}
|
||||
|
||||
_git_zsh ()
|
||||
{
|
||||
__gitcomp "v1.2"
|
||||
}
|
||||
|
||||
__git_complete_command ()
|
||||
{
|
||||
emulate -L zsh
|
||||
@ -206,9 +202,7 @@ __git_zsh_main ()
|
||||
{
|
||||
local curcontext="$curcontext" state state_descr line
|
||||
typeset -A opt_args
|
||||
local -a orig_words __git_C_args
|
||||
|
||||
orig_words=( ${words[@]} )
|
||||
local -a __git_C_args
|
||||
|
||||
_arguments -C \
|
||||
'(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
|
||||
@ -245,7 +239,7 @@ __git_zsh_main ()
|
||||
emulate ksh -c __git_complete_config_variable_name_and_value
|
||||
;;
|
||||
(arg)
|
||||
local command="${words[1]}" __git_dir
|
||||
local command="${words[1]}" __git_dir __git_cmd_idx=1
|
||||
|
||||
if (( $+opt_args[--bare] )); then
|
||||
__git_dir='.'
|
||||
@ -259,7 +253,7 @@ __git_zsh_main ()
|
||||
|
||||
(( $+opt_args[--help] )) && command='help'
|
||||
|
||||
words=( ${orig_words[@]} )
|
||||
words=( git ${words[@]} )
|
||||
|
||||
__git_zsh_bash_func $command
|
||||
;;
|
||||
@ -269,7 +263,7 @@ __git_zsh_main ()
|
||||
_git ()
|
||||
{
|
||||
local _ret=1
|
||||
local cur cword prev
|
||||
local cur cword prev __git_cmd_idx=0
|
||||
|
||||
cur=${words[CURRENT]}
|
||||
prev=${words[CURRENT-1]}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -138,6 +138,7 @@ __git_ps1_show_upstream ()
|
||||
done <<< "$output"
|
||||
|
||||
# parse configuration values
|
||||
local option
|
||||
for option in ${GIT_PS1_SHOWUPSTREAM}; do
|
||||
case "$option" in
|
||||
git|svn) upstream="$option" ;;
|
||||
@ -432,8 +433,8 @@ __git_ps1 ()
|
||||
fi
|
||||
|
||||
local sparse=""
|
||||
if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
|
||||
[ -z "${GIT_PS1_OMITSPARSESTATE}" ] &&
|
||||
if [ -z "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
|
||||
[ -z "${GIT_PS1_OMITSPARSESTATE-}" ] &&
|
||||
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
|
||||
sparse="|SPARSE"
|
||||
fi
|
||||
@ -542,7 +543,7 @@ __git_ps1 ()
|
||||
u="%${ZSH_VERSION+%}"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
|
||||
if [ -n "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
|
||||
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
|
||||
h="?"
|
||||
fi
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
url="https://raw.githubusercontent.com/felipec/git-completion"
|
||||
version="1.2"
|
||||
version="1.3.6"
|
||||
|
||||
curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
|
||||
curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&
|
||||
|
Loading…
Reference in New Issue
Block a user