Merge branch 'sg/completion-updates'

* sg/completion-updates:
  Revert "completion: don't declare 'local words' to make zsh happy"
  git-completion: fix regression in zsh support
  completion: move private shopt shim for zsh to __git_ namespace
  completion: don't declare 'local words' to make zsh happy
This commit is contained in:
Junio C Hamano
2011-05-16 16:47:00 -07:00

View File

@ -628,12 +628,12 @@ __git_refs_remotes ()
__git_remotes () __git_remotes ()
{ {
local i ngoff IFS=$'\n' d="$(__gitdir)" local i ngoff IFS=$'\n' d="$(__gitdir)"
shopt -q nullglob || ngoff=1 __git_shopt -q nullglob || ngoff=1
shopt -s nullglob __git_shopt -s nullglob
for i in "$d/remotes"/*; do for i in "$d/remotes"/*; do
echo ${i#$d/remotes/} echo ${i#$d/remotes/}
done done
[ "$ngoff" ] && shopt -u nullglob [ "$ngoff" ] && __git_shopt -u nullglob
for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do
i="${i#remote.}" i="${i#remote.}"
echo "${i/.url*/}" echo "${i/.url*/}"
@ -2608,6 +2608,10 @@ _git ()
if [[ -n ${ZSH_VERSION-} ]]; then if [[ -n ${ZSH_VERSION-} ]]; then
emulate -L bash emulate -L bash
setopt KSH_TYPESET setopt KSH_TYPESET
# workaround zsh's bug that leaves 'words' as a special
# variable in versions < 4.3.12
typeset -h words
fi fi
local cur words cword prev local cur words cword prev
@ -2659,6 +2663,10 @@ _gitk ()
if [[ -n ${ZSH_VERSION-} ]]; then if [[ -n ${ZSH_VERSION-} ]]; then
emulate -L bash emulate -L bash
setopt KSH_TYPESET setopt KSH_TYPESET
# workaround zsh's bug that leaves 'words' as a special
# variable in versions < 4.3.12
typeset -h words
fi fi
local cur words cword prev local cur words cword prev
@ -2699,7 +2707,7 @@ complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
fi fi
if [[ -n ${ZSH_VERSION-} ]]; then if [[ -n ${ZSH_VERSION-} ]]; then
shopt () { __git_shopt () {
local option local option
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
echo "USAGE: $0 (-q|-s|-u) <option>" >&2 echo "USAGE: $0 (-q|-s|-u) <option>" >&2
@ -2722,4 +2730,8 @@ if [[ -n ${ZSH_VERSION-} ]]; then
return 1 return 1
esac esac
} }
else
__git_shopt () {
shopt "$@"
}
fi fi