completion: fix zsh check under bash with 'set -u'
PATCH 1/1 completion: fix zsh check under bash with 'set -u'
Commit 06f44c3 (completion: make compatible with zsh) broke bash compatibility with 'set -u': a warning was generated when checking $ZSH_VERSION. The solution is to supply a default value, using ${ZSH_VERSION-}. Thanks to SZEDER Gábor for the fix.
--- contrib/completion/git-completion.bash | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
contrib/completion/git-completion.bash +3 -3
@@ -2345,7 +2345,7 @@ _git () { local i c=1 command __git_dir - if [[ -n $ZSH_VERSION ]]; then + if [[ -n ${ZSH_VERSION-} ]]; then emulate -L bash setopt KSH_TYPESET fi
@@ -2394,7 +2394,7 @@ _git () _gitk () { - if [[ -n $ZSH_VERSION ]]; then + if [[ -n ${ZSH_VERSION-} ]]; then emulate -L bash setopt KSH_TYPESET fi
@@ -2434,7 +2434,7 @@ complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \ || complete -o default -o nospace -F _git git.exe fi -if [[ -n $ZSH_VERSION ]]; then +if [[ -n ${ZSH_VERSION-} ]]; then shopt () { local option if [ $# -ne 2 ]; then
Signature · 1 line
1.7.3.2
Hi Mark,
Quoted 9 lines · Mark Lodato
Commit 06f44c3 (completion: make compatible with zsh) broke bash compatibility with 'set -u': a warning was generated when checking $ZSH_VERSION. The solution is to supply a default value, using ${ZSH_VERSION-}. Thanks to SZEDER Gábor for the fix.
Signed-off-by Mark Lodato <[email protected]>--- contrib/completion/git-completion.bash | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Thanks. It works with bash and set -u, so if it works with zsh as well, then I'm for it.
While you are around, could you please have a look at this thread?
http://thread.gmane.org/gmane.comp.version-control.git/160103/focus=160135
Thanks,
Gábor