mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-08 12:01:21 +02:00
25487: whitespace changes from Mikael Magnusson.
This commit is contained in:
parent
123ebafbba
commit
117d3ded00
2 changed files with 47 additions and 44 deletions
|
@ -1,5 +1,8 @@
|
||||||
2008-08-19 Clint Adams <clint@zsh.org>
|
2008-08-19 Clint Adams <clint@zsh.org>
|
||||||
|
|
||||||
|
* 25487: Completion/Unix/Command/_git: whitespace changes from
|
||||||
|
Mikael Magnusson.
|
||||||
|
|
||||||
* 25486: Completion/Unix/Command/_git: patch to allow --shared to
|
* 25486: Completion/Unix/Command/_git: patch to allow --shared to
|
||||||
be completed without --local with git clone.
|
be completed without --local with git clone.
|
||||||
|
|
||||||
|
|
|
@ -4256,54 +4256,54 @@ __git_is_indexed () {
|
||||||
[[ -n $(git ls-files $REPLY) ]]
|
[[ -n $(git ls-files $REPLY) ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
local curcontext=$curcontext ret=1
|
local curcontext=$curcontext ret=1
|
||||||
|
|
||||||
# fun with $words[] and $CURRENT to enable completion for args
|
# fun with $words[] and $CURRENT to enable completion for args
|
||||||
# to git aliases (eg. git co <TAB>)
|
# to git aliases (eg. git co <TAB>)
|
||||||
local -A git_aliases
|
local -A git_aliases
|
||||||
# TODO: filling git_aliases like this is ugly. I didn't get it working elegantly.
|
# TODO: filling git_aliases like this is ugly. I didn't get it working elegantly.
|
||||||
local oifs=$IFS
|
local oifs=$IFS
|
||||||
IFS=$'\0'
|
IFS=$'\0'
|
||||||
git_aliases=(${=${(0)${(@)${${${(f)"$(git config --get-regexp alias.\*)"}/(#s)alias./}/ /$'\0'}}}})
|
git_aliases=(${=${(0)${(@)${${${(f)"$(git config --get-regexp alias.\*)"}/(#s)alias./}/ /$'\0'}}}})
|
||||||
IFS=$oifs ; unset oifs
|
IFS=$oifs ; unset oifs
|
||||||
|
|
||||||
if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then
|
if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then
|
||||||
local -a tmpwords
|
local -a tmpwords
|
||||||
tmpwords=(${words[1]} ${(z)git_aliases[$words[2]]})
|
tmpwords=(${words[1]} ${(z)git_aliases[$words[2]]})
|
||||||
if [[ -z "${words[3,-1]}" ]] ; then
|
if [[ -z "${words[3,-1]}" ]] ; then
|
||||||
tmpwords[$(( ${#tmpwords} + 1 ))]=""
|
tmpwords[$(( ${#tmpwords} + 1 ))]=""
|
||||||
else
|
|
||||||
tmpwords+=("${words[3,-1]}")
|
|
||||||
fi
|
|
||||||
words=("${tmpwords[@]}")
|
|
||||||
(( CURRENT += ${#${(z)git_aliases[$words[2]]}} - 1 ))
|
|
||||||
unset tmpwords
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $service == git ]]; then
|
|
||||||
local state line
|
|
||||||
declare -A opt_args
|
|
||||||
_arguments -C \
|
|
||||||
'(- :)--version[display version information]' \
|
|
||||||
'(- :)--help[display help message]' \
|
|
||||||
'--exec-path=-[path containing core git-programs]::directory:_directories' \
|
|
||||||
'(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \
|
|
||||||
'--git-dir=-[path to repository]:directory:_directories' \
|
|
||||||
'--bare[use $PWD as repository]' \
|
|
||||||
':command:->command' \
|
|
||||||
'*::options:->options' && ret=0
|
|
||||||
case $state in
|
|
||||||
(command)
|
|
||||||
__git_aliases_and_commands
|
|
||||||
;;
|
|
||||||
(options)
|
|
||||||
curcontext="${curcontext%:*:*}:git-$words[1]:"
|
|
||||||
_call_function ret _git-$words[1]
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
else
|
||||||
_call_function ret _$service
|
tmpwords+=("${words[3,-1]}")
|
||||||
fi
|
fi
|
||||||
|
words=("${tmpwords[@]}")
|
||||||
|
(( CURRENT += ${#${(z)git_aliases[$words[2]]}} - 1 ))
|
||||||
|
unset tmpwords
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $service == git ]]; then
|
||||||
|
local state line
|
||||||
|
declare -A opt_args
|
||||||
|
_arguments -C \
|
||||||
|
'(- :)--version[display version information]' \
|
||||||
|
'(- :)--help[display help message]' \
|
||||||
|
'--exec-path=-[path containing core git-programs]::directory:_directories' \
|
||||||
|
'(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \
|
||||||
|
'--git-dir=-[path to repository]:directory:_directories' \
|
||||||
|
'--bare[use $PWD as repository]' \
|
||||||
|
':command:->command' \
|
||||||
|
'*::options:->options' && ret=0
|
||||||
|
case $state in
|
||||||
|
(command)
|
||||||
|
__git_aliases_and_commands
|
||||||
|
;;
|
||||||
|
(options)
|
||||||
|
curcontext="${curcontext%:*:*}:git-$words[1]:"
|
||||||
|
_call_function ret _git-$words[1]
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
_call_function ret _$service
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_git
|
_git
|
||||||
|
|
Loading…
Reference in a new issue