Skip to content

Commit 0184435

Browse files
committed
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
2 parents 8cee0f1 + 2df7683 commit 0184435

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

contrib/completion/git-completion.bash

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,12 @@ __git_refs_remotes ()
628628
__git_remotes ()
629629
{
630630
local i ngoff IFS=$'\n' d="$(__gitdir)"
631-
shopt -q nullglob || ngoff=1
632-
shopt -s nullglob
631+
__git_shopt -q nullglob || ngoff=1
632+
__git_shopt -s nullglob
633633
for i in "$d/remotes"/*; do
634634
echo ${i#$d/remotes/}
635635
done
636-
[ "$ngoff" ] && shopt -u nullglob
636+
[ "$ngoff" ] && __git_shopt -u nullglob
637637
for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do
638638
i="${i#remote.}"
639639
echo "${i/.url*/}"
@@ -2608,6 +2608,10 @@ _git ()
26082608
if [[ -n ${ZSH_VERSION-} ]]; then
26092609
emulate -L bash
26102610
setopt KSH_TYPESET
2611+
2612+
# workaround zsh's bug that leaves 'words' as a special
2613+
# variable in versions < 4.3.12
2614+
typeset -h words
26112615
fi
26122616

26132617
local cur words cword prev
@@ -2659,6 +2663,10 @@ _gitk ()
26592663
if [[ -n ${ZSH_VERSION-} ]]; then
26602664
emulate -L bash
26612665
setopt KSH_TYPESET
2666+
2667+
# workaround zsh's bug that leaves 'words' as a special
2668+
# variable in versions < 4.3.12
2669+
typeset -h words
26622670
fi
26632671

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

27012709
if [[ -n ${ZSH_VERSION-} ]]; then
2702-
shopt () {
2710+
__git_shopt () {
27032711
local option
27042712
if [ $# -ne 2 ]; then
27052713
echo "USAGE: $0 (-q|-s|-u) <option>" >&2
@@ -2722,4 +2730,8 @@ if [[ -n ${ZSH_VERSION-} ]]; then
27222730
return 1
27232731
esac
27242732
}
2733+
else
2734+
__git_shopt () {
2735+
shopt "$@"
2736+
}
27252737
fi

0 commit comments

Comments
 (0)