Skip to content

Commit

Permalink
Merge branch 'sg/completion-updates'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed May 16, 2011
2 parents 8cee0f1 + 2df7683 commit 0184435
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,12 @@ __git_refs_remotes ()
__git_remotes ()
{
local i ngoff IFS=$'\n' d="$(__gitdir)"
shopt -q nullglob || ngoff=1
shopt -s nullglob
__git_shopt -q nullglob || ngoff=1
__git_shopt -s nullglob
for i in "$d/remotes"/*; do
echo ${i#$d/remotes/}
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
i="${i#remote.}"
echo "${i/.url*/}"
Expand Down Expand Up @@ -2608,6 +2608,10 @@ _git ()
if [[ -n ${ZSH_VERSION-} ]]; then
emulate -L bash
setopt KSH_TYPESET

# workaround zsh's bug that leaves 'words' as a special
# variable in versions < 4.3.12
typeset -h words
fi

local cur words cword prev
Expand Down Expand Up @@ -2659,6 +2663,10 @@ _gitk ()
if [[ -n ${ZSH_VERSION-} ]]; then
emulate -L bash
setopt KSH_TYPESET

# workaround zsh's bug that leaves 'words' as a special
# variable in versions < 4.3.12
typeset -h words
fi

local cur words cword prev
Expand Down Expand Up @@ -2699,7 +2707,7 @@ complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
fi

if [[ -n ${ZSH_VERSION-} ]]; then
shopt () {
__git_shopt () {
local option
if [ $# -ne 2 ]; then
echo "USAGE: $0 (-q|-s|-u) <option>" >&2
Expand All @@ -2722,4 +2730,8 @@ if [[ -n ${ZSH_VERSION-} ]]; then
return 1
esac
}
else
__git_shopt () {
shopt "$@"
}
fi

0 comments on commit 0184435

Please sign in to comment.